1、创建一个2G的分区,文件系统为ext2,卷标为DATA,块大小为1024,预留管理空间为磁盘分区的8%;挂载至/backup目录,要求使用卷标进行挂载,且在挂载时启动此文件系统上的acl功能; 进行分区操作: [root@localhost ~]# fdisk -l /dev/sdc Disk /dev/sdc: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdc doesn't contain a valid partition table [root@localhost ~]# fdisk /dev/sdc ...... [root@localhost ~]# fdisk -l /dev/sdc Disk /dev/sdc: 3221 MB, 3221225472 bytes 255 heads, 63 sectors/track, 391 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdc1 1 244 1959898+ 83 Linux [root@localhost ~]# cat /proc/partitions ..... 创建文件系统 [root@localhost ~]# mke2fs -L DATA -b 1024 -m 8 /dev/sdc1 mke2fs 1.39 (29-May-2006) Filesystem label=DATA OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 245760 inodes, 1959896 blocks 156791 blocks (8.00%) reserved for the super user First data block=1 Maximum filesystem blocks=69206016 240 block groups 8192 blocks per group, 8192 fragments per group 1024 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553, 1024001 Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. 验证是否创建正确: blkid /dev/sdc1 e2label /dev/sdc1 tune2fs -l /dev/sdc1 dumpe2fs /dev/sdc1 dumpe2fs -h /dev/sdc1 挂载操作 [root@localhost ~]# mount LABEL=DATA -o acl /backup [root@localhost ~]# mount /dev/sda2 on / type ext3 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda3 on /home type ext3 (rw) /dev/sda1 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw) none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) /dev/sdc1 on /backup type ext2 (rw,acl) 2、将此文件系统的超级块中的信息中包含了block和inode的行保存至/tmp/partition.txt中; [root@localhost ~]# tune2fs -l /dev/sdc1 | grep -E 'inode|block' Filesystem features: resize_inode dir_index filetype sparse_super Reserved block count: 156791 Free blocks: 1925766 Free inodes: 245749 First block: 1 Reserved GDT blocks: 256 Inode blocks per group: 128 Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 [root@localhost ~]# tune2fs -l /dev/sdc1 | grep -E 'inode|block' >> /tmp/partition.txt 3、复制/etc目录中的所有文件至此文件系统;而后调整此文件系统类型为ext3,要求不能损坏已经复制而来的文件; [root@localhost ~]# cp -r /etc /backup/ [root@localhost ~]# tune2fs -j /dev/sdc1 tune2fs 1.39 (29-May-2006) Creating journal inode: done This filesystem will be automatically checked every 38 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@localhost ~]# 4、调整其预留百分比为3%; [root@localhost ~]# tune2fs -m 3 /backup 5、以重新挂载的方式挂载此文件系统为不更新访问时间戳,并验正其效果; [root@localhost etc]# mount -o remount,noatime /dev/sdc1 /backup cat stat 6、对此文件系统强行做一次检测; [root@localhost ~]# e2fsck -f /dev/sdc1 7、删除复制而来的所有文件,并将此文件系统重新挂载为同步(sync);而后再次复制/etc目录中的所有文件至此挂载点,体验其性能变化; [root@localhost ~]# mount -o remount,async /backup [root@localhost ~]# date +%s 1404019264 [root@localhost ~]# cp -r /etc /backup [root@localhost ~]# date +%s 1404019272 [root@localhost ~]# mount -o remount,sync /backup [root@localhost ~]# rm -rf /backup/etc [root@localhost ~]# date +%s 1404019292 [root@localhost ~]# cp -r /etc /backup [root@localhost ~]# date +%s 1404019329 |
Linux磁盘管理与文件系统实战
精选 原创
©著作权归作者所有:来自51CTO博客作者zfz_linux_boy的原创作品,请联系作者获取转载授权,否则将追究法律责任
下一篇:玩转Linux压缩及归档
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
vsphere环境,扩容Linux标准磁盘及文件系统
扩容Linux标准磁盘及文件系统
文件系统 标准磁盘 扩容 -
RHCE 学习笔记之文件系统和磁盘管理09
RHCE 学习笔记之文件系统和磁盘管理09
文件系统 ide 2d mount unmount -
Linux的磁盘管理与文件系统
本篇内容如下: 1、硬盘结构 2、磁盘分区类型 &nbs
Linux 文件系统 磁盘管理