關於Linux磁盤和文件系統的學習總結:node
練習:建立一個10G文件系統,類型爲ext4,要求開機可自動掛載至/mydata目錄;linux
#建立一個10G的邏輯分區 [root@localhost ~]# fdisk /dev/sda Welcome to fdisk (util-linux 2.23.2). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): n All primary partitions are in use Adding logical partition 10 First sector (108558336-251658239, default 108558336): Using default value 108558336 Last sector, +sectors or +size{K,M,G} (108558336-251658239, default 251658239): +10G Partition 10 of type Linux and of size 10 GiB is set Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot or after you run partprobe(8) or kpartx(8) Syncing disks. #內核重讀分區表信息 [root@localhost ~]# partprobe #建立文件系統ext4 [root@localhost ~]# mkfs -t ext4 /dev/sda10 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 655360 inodes, 2621440 blocks 131072 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2151677952 80 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done #編輯/etc/fstab設置開機啓動 [root@localhost ~]# vim /etc/fstab LABEL=homework /mydata ext4 defaults 0 0 #掛載全部/etc/fstab下未掛載的設備 [root@localhost ~]# mount -a #查看掛載的設備 [root@localhost ~]# df Filesystem 1K-blocks Used Available Use% Mounted on ...... /dev/sda5 9947976 36976 9382616 1% /home /dev/sda10 10190100 36888 9612540 1% /mydata
若有錯誤,敬請指正!vim
謝謝!
bash