为什么 parted 和 df 显示不同的磁盘大小

为什么 parted 和 df 显示不同的磁盘大小

我知道这个问题已经被问过了,但答案通常有 1-5% 的差异。我使用这两个命令计算出的磁盘空间差别很大,sda2 应该是 20TB,但 df -h 显示只有 3.9TB。谢谢你的帮助。

$ df -h

FilesystemSize  Used Avail Use% Mounted on

/dev/sdd1        72G   46G   23G  67% /

udev             32G   12K   32G   1% /dev

tmpfs           6.3G  808K  6.3G   1% /run

none            5.0M     0  5.0M   0% /run/lock

none             32G  216K   32G   1% /run/shm

/dev/sde1       135G  188M  128G   1% /work/data1

/dev/sda2       3.9T  3.0T  758G  80% /work/data

$ sudo lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL

NAME   FSTYPE   SIZE MOUNTPOINT         LABEL

sda              20T

├─sda1            1M

├─sda2 ext2      20T /work/data2

└─sda3 swap      64G

sdd           136.8G

└─sdd1 ext4   136.7G /

sde    ext2   136.8G

└─sde1 ext4   136.7G /work/data1

sr0            1024M

$ sudo fdisk -l /dev/sda

WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sda: 21998.3 GB, 21998285619200 bytes
255 heads, 63 sectors/track, 2674472 cylinders, total 42965401600 sectors
Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1  4294967295  2147483647+  ee  GPT

$ sudo parted -ls

Model: DELL PERC H800 (scsi)

Disk /dev/sda: 22.0TB

Sector size (logical/physical): 512B/512B

Partition Table: gpt

Number  Start   End     Size    File system     Name  Flags

 1      1049kB  2097kB  1049kB                        bios_grub

 2      2097kB  21.9TB  21.9TB  ext2                  msftdata

 3      21.9TB  22.0TB  68.7GB  linux-swap(v1)

Model: SEAGATE ST9146803SS (scsi)

Disk /dev/sdd: 147GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags

 1      1049kB  147GB  147GB  primary  ext4         boot

Model: SEAGATE ST9146803SS (scsi)

Disk /dev/sde: 147GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number  Start   End    Size   Type     File system  Flags

 1      1049kB  147GB  147GB  primary  ext4

答案1

df显示的大小文件系统partedlsblk显示大小分区。您的 20 TB 分区/dev/sda2包含扩展2文件系统。tune2fs -l /dev/sda2它说明了什么?具体来说,块大小是多少?请注意,如果块大小为 1 KiB,则 ext2 文件系统的最大大小为 4 TiB。

相关内容