linux file system-related commands (df / du / fsck / dumpe2fs)

A file system view command df

format

df [options] [mount point]

Options

name effect
-a Show all file system information, including specific file system, such as / proc, / sysfs
-h Capacity usage display unit, such as KB, MB, or the like GB
-T Displays the file system type
-m Display capacity in MB
-k In KB display capacity, the default is in KB

Examples

# df命令
[root@izm5e2q95pbpe1hh0kkwoiz tmp]# df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       41151808 13866168  25172208  36% /
devtmpfs          932240        0    932240   0% /dev
tmpfs             941744        0    941744   0% /dev/shm
tmpfs             941744      492    941252   1% /run
tmpfs             941744        0    941744   0% /sys/fs/cgroup
tmpfs             188352        0    188352   0% /run/user/0

[root@izm5e2q95pbpe1hh0kkwoiz tmp]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        40G   14G   25G  36% /
devtmpfs        911M     0  911M   0% /dev
tmpfs           920M     0  920M   0% /dev/shm
tmpfs           920M  492K  920M   1% /run
tmpfs           920M     0  920M   0% /sys/fs/cgroup
tmpfs           184M     0  184M   0% /run/user/0

II. Statistical directory or file size

format

du [options] [directory or file name]

Options

Options effect
-a Show disk usage of each sub-file. The default disk usage statistics only subdirectories
-h Habits displays disk footprint, such as KB, MB or GB, etc.
-s Statistics footprint without listing footprint subdirectories and sub-files

Examples

[root@izm5e2q95pbpe1hh0kkwoiz tmp]# du -h
4.0K    ./.font-unix
4.0K    ./.ICE-unix
4.0K    ./.X11-unix
4.0K    ./.XIM-unix
36K     ./hsperfdata_root
4.0K    ./systemd-private-9255c5ee9ec84f5987c1d9ba485e177e-ntpd.service-eKcnmD/tmp
8.0K    ./systemd-private-9255c5ee9ec84f5987c1d9ba485e177e-ntpd.service-eKcnmD
4.0K    ./.Test-unix
512K    .

[root@izm5e2q95pbpe1hh0kkwoiz tmp]# du -sh
512K    .

The difference between du and df command command

df command space than statistical du command statistics of a large space !!!!

占用的空间(最常见的就是文件已经删除,但是程序并没有释放空间)

du命令是面向文件的,只会计算文件或目录占用的空间

III. Fsck command to repair the file system

format

fsck [options] partition device file name

The system automatically performs the boot

Options

Options effect
-a Without user prompts, Automatically fix file system
-Y Auto repair Consistent action and -a, but some file system supports only -y

IV. The disk status display command dumpe2fs

format

dumpe2fs partition device file name

Examples

[root@izm5e2q95pbpe1hh0kkwoiz tmp]# df
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/vda1       41151808 13866916  25171460  36% /
devtmpfs          932240        0    932240   0% /dev
tmpfs             941744        0    941744   0% /dev/shm
tmpfs             941744      492    941252   1% /run
tmpfs             941744        0    941744   0% /sys/fs/cgroup
tmpfs             188352        0    188352   0% /run/user/0


[root@izm5e2q95pbpe1hh0kkwoiz tmp]# dumpe2fs /dev/vda1
dumpe2fs 1.42.9 (28-Dec-2013)
Filesystem volume name:   <none>
Last mounted on:          /
Filesystem UUID:          eb448abb-3012-4d8d-bcde-94434d586a31
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              2621440
Block count:              10485248
Reserved block count:     524262
Free blocks:              8958387
Free inodes:              2519237
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      1021
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
RAID stride:              32639
Flex block group size:    16
Filesystem created:       Sun Oct 15 23:18:59 2017
Last mount time:          Tue Aug 14 10:15:43 2018
Last write time:          Tue Aug 14 18:15:42 2018
Mount count:              6
Maximum mount count:      -1
Last checked:             Wed Jun 27 22:35:57 2018
Check interval:           0 (<none>)
Lifetime writes:          30 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal inode:            8
First orphan inode:       1050280
Default directory hash:   half_md4
Directory Hash Seed:      2579899c-6862-4625-a8e6-425550384200
Journal backup:           inode blocks
Journal features:         journal_incompat_revoke
Journal size:             128M
Journal length:           32768
Journal sequence:         0x006d2f6d
Journal start:            5782
......

Guess you like

Origin www.cnblogs.com/eternityz/p/12377125.html