标签:磁盘 文件系统
关于Linux磁盘和文件系统的学习总结:
练习:创建一个10G文件系统,类型为ext4,要求开机可自动挂载至/mydata目录;
#创建一个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如有错误,敬请指正!
谢谢!
标签:磁盘 文件系统
原文地址:http://rogerwang.blog.51cto.com/5326353/1695074