標籤:linux營運 磁碟管理 建立檔案系統 掛載
磁碟管理---建立檔案系統與掛載
-
建立檔案系統
格式化
[[email protected] devices]# mkfs.ext4 /dev/sdb1
或者
[[email protected] devices]# mkfs -t ext4 /dev/sdb1
mkfs.ext4格式化時候的選項:
-b——指定檔案系統塊的大小
-g——指定每個塊組的大小
-i——指定每個i節點佔用多少位元組磁碟空間
-I——指定檔案系統i節點所佔用空間大小
-N——指定i節點的數量,近似值
-L——指定磁碟分割的標籤
1) 格式化時指定塊的大小
[[email protected] ~]# mkfs.ext4 -b 1024 /dev/sdb2
[[email protected] ~]# dumpe2fs -h /dev/sdb2 | grep Block
dumpe2fs 1.41.12 (17-May-2010)
Block count: 208844
Block size: 1024
Blocks per group: 8192
2) 格式化時指定分區的標籤(卷標)
[[email protected] ~]# mkfs.ext4 -L data /dev/sdb2
查看分區的卷標
[[email protected] ~]# e2label /dev/sdb2
data
2.掛載
掛載的目的:
通過掛載點,提供訪問裝置的介面
1) mount命令
——查看當前掛載情況
[[email protected] ~]# mount
/dev/sda2 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
——查看掛載的時候顯示分區的標籤
[[email protected] ~]# mount -l
2) mount掛載
文法格式
mount [-fnrsvw] [-t vfstype] [-o options] device dir
掛載選項
async——非同步
sync——同步
atime——訪問時間
noatime——不更改訪問時間
auto——自動
defaults—— rw, suid, dev, exec, auto, nouser, async,and relatime.
remount——重新掛載
舉例子:
[[email protected] ~]# mount -t ext4 -o ro /dev/sdb2 /mnt/sdb2
[[email protected] ~]# mount | grep sdb
/dev/sdb2 on /mnt/sdb2 type ext4 (ro)
[[email protected] ~]# cd /mnt/sdb2/
[[email protected] sdb2]# ls
lost+found
[[email protected] sdb2]# touch abc
touch: cannot touch `abc‘: Read-only file system
[[email protected] sdb2]# cd
[[email protected] ~]# mount -o rw,remount /dev/sdb2
[[email protected] ~]# cd /mnt/sdb2/
[[email protected] sdb2]# ls
lost+found
[[email protected] sdb2]# touch a
[[email protected] sdb2]# ls
a lost+found
本文出自 “空穀幽蘭” 部落格,請務必保留此出處http://2489843.blog.51cto.com/2479843/1671276
Linux營運系統工程師系列---22