1.文件系统相关知识梳理
2.相关命令
2.1 blkid
查看当前被格式化的设备,下面结果显示的意思是sda1,sda2是物理硬盘,TYPE是代表文件系统的类型。UUID为系统中的存储设备提供唯一的标识字符串。
/dev/sda1: UUID="3cebc76f-8b3d-47a2-a578-97c734921bcb" TYPE="xfs"
/dev/sda2: UUID="44SQbo-7y9c-uOHS-rzJ0-XZkA-L38v-5AniPP" TYPE="LVM2_member"
/dev/mapper/centos-root: UUID="b2bbd263-58d9-44c8-a71d-f75fd3c08487" TYPE="xfs"
/dev/mapper/centos-swap: UUID="f4d6b932-f4cf-4f6d-9970-264db3c12bba" TYPE="swap"
/dev/mapper/centos-home: UUID="dac39b62-8cf9-4444-838c-0ea68e971b92" TYPE="xfs"
2.2 dumpe2fs与xfs_info
dumpe2fs是ext文件系统下查看超级区块的信息,xfs_info是xfs文件系统中查看超积区块的信息。
以xfs文件系统为例:
[root@hugemachine ~]# xfs_info /dev/sda1
meta-data=/dev/sda1 isize=512 agcount=4, agsize=65536 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
isize=512代表inode的大小,单位是B,ext的inode最大只有4B;
bsize=4096代表区块的大小。
sectsz=4096是代表每个扇区的大小
2.3 文件系统的简单操作
2.3.1 df
查看磁盘的使用情况,文件系统的挂载位置
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/centos-root 52403200 6914272 45488928 14% /
devtmpfs 164935784 0 164935784 0% /dev
tmpfs 164951780 0 164951780 0% /dev/shm
tmpfs 164951780 543396 164408384 1% /run
tmpfs 164951780 0 164951780 0% /sys/fs/cgroup
/dev/sda1 1038336 182704 855632 18% /boot
/dev/mapper/centos-home 1111991812 6803024 1105188788 1% /home
tmpfs 32990360 12 32990348 1% /run/user/42
tmpfs 32990360 0 32990360 0% /run/user/0
2.3.2 du
[root@hugemachine ~]# du -h
0 ./.cache/dconf
4.0K ./.cache/imsettings
0 ./.cache/evolution/addressbook/trash
0 ./.cache/evolution/addressbook
0 ./.cache/evolution/calendar/trash
0 ./.cache/evolution/calendar
0 ./.cache/evolution/mail/trash
0 ./.cache/evolution/mail
0 ./.cache/evolution/memos/trash
0 ./.cache/evolution/memos
0 ./.cache/evolution/sources/trash
0 ./.cache/evolution/sources
0 ./.cache/evolution/tasks/trash
0 ./.cache/evolution/tasks
0 ./.cache/evolution
0 ./.cache/gnome-shell
3.3M ./.cache/tracker