LFS磁碟格式化相關

2022-09-01 15:24:16 字數 2306 閱讀 8934

mke2fs 1.42.9 (4-feb-2014)

fs_types for mke2fs.conf resolution: 'ext3'

filesystem label=

os type: linux

block size=4096 (log=2)

fragment size=4096 (log=2)

stride=0 blocks, stripe width=0 blocks

312624 inodes, 1249053 blocks

62452 blocks (5.00%) reserved for the super user

first data block=0

maximum filesystem blocks=1279262720

39 block groups

32768 blocks per group, 32768 fragments per group

8016 inodes per group

superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736

allocating group tables: done

writing inode tables: done

creating journal (32768 blocks): done

writing superblocks and filesystem accounting information: done

disk /dev/sda: 320.1 gb, 320072933376 bytes

255 heads, 63 sectors/track, 38913 cylinders, total 625142448 sectors

units = sectors of 1 * 512 = 512 bytes

sector size (logical/physical): 512 bytes / 512 bytes

i/o size (minimum/optimal): 512 bytes / 512 bytes

disk identifier: 0x000d1c42

device boot start end blocks id system

/dev/sda1 * 2048 20000767 9999360 83 linux

/dev/sda2 20000768 220000255 99999744 83 linux

/dev/sda3 220002302 232194047 6095873 5 extended

/dev/sda4 * 232194048 242186477 4996215 83 linux

/dev/sda5 220002304 220194815 96256 83 linux

/dev/sda6 220196864 232194047 5998592 82 linux swap / solaris

useradd -s /bin/bash -g lfs -m -k /dev/null lfs

命令列選項的意思:

-s /bin/bash

把 bash 設定為 lfs 使用者的預設 shell。

-g lfs

這個選項將使用者 lfs 新增到組 lfs 中。

-m為 lfs 使用者建立主目錄。

-k /dev/null

這個引數通過改變輸入位置為特殊的空(null)裝置,以防止可能從乙個模版目錄中(預設是 /etc/skel)複製檔案。

lfs這是建立的組和使用者的實際名稱。

passwd lfs

注:chown 命令把改變檔案的擁有者

chown -v lfs $lfs/tools

這裡把$lfs/tools資料夾的擁有者變成lfs使用者

su -lfs 切換成lfs使用者身份

注:有沒有發現和我們平時的切換有點不一樣,這裡多了乙個 -

su和su - 的區別 su只是改變使用者的身份但沒有改變shell環境 su - 才會去改變shell環境

換句話說 不帶-的su不會讀取目標使用者的環境配置檔案,帶-的su才會讀。

隨便說一句,細節很重要,在最近的工作中感覺到了細節的重要性,要學會多思考!不會思考和鹹魚有什麼區別。

一邊被罵一邊工作,感覺學到的很好orz。

磁碟格式化

檢視系統支援的檔案系統格式 cat etc filesystems 格式化 mke2fs t ext4 b 2048 dev sdb1 不支援格式化xfs檔案系統格式 t後面加的是檔案系統格式 如果不指定,預設為ext2 b後面加的是指定塊兒大小 b可省略 m指定分割槽預留的大小 mke2fs t ...

47 磁碟格式化

注 在磁碟劃分好之後 是不能使用的 還嫌格式化,因為liunx和win不一樣 最好還需要繼續掛載目錄 在centos6的版本 同版本 之前 都是用ext的格式 但是在centos的之後就換了一種格式xfs 檢視系統所支援的分割槽格式 root localhost cat etc filesystem...

磁碟格式化程式 測試程式

testfs.c include include include include rt.h static char program name testfs static int dev 1 static char device name null static char super block bu...