使用 resize2fs 缩小文件系统时如何计算正确的分区大小

使用 resize2fs 缩小文件系统时如何计算正确的分区大小

在 GNU/Linux 上使用 resize2fs 缩小只读文件系统后,如何确定缩小的文件系统的正确分区条目?

远程主机初始分区方案:

Disk /dev/sda: 1,8 TiB, 1999844147200 bytes, 3905945600 sectors
Disk model: xxx       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf79ea8df

Device     Boot      Start        End    Sectors  Size Id Type
/dev/sda1  *          2048     487423     485376  237M 83 Linux
/dev/sda2           487424 3841943551 3841456128  1,8T 83 Linux
/dev/sda3       3841943552 3883886591   41943040   20G 83 Linux

Command (m for help):

发出调整大小命令:

[root@home ~]# resize2fs /dev/sda2 200G
resize2fs 1.44.5 (15-Dec-2018)
Resizing the filesystem on /dev/sda2 to 52428800 (4k) blocks.
The filesystem on /dev/sda2 is now 52428800 (4k) blocks long.

当以 487424 作为起始扇区、大小为 8 乘以 52428800 * 512 字节块的 /dev/sda2 重新创建分区条目时,创建的分区是否确实覆盖了整个收缩的文件系统,如何证明这一点?

Disk /dev/sda: 1,8 TiB, 1999844147200 bytes, 3905945600 sectors
Disk model: xxx       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf79ea8df

Device     Boot      Start        End   Sectors  Size Id Type
/dev/sda1  *          2048     487423    485376  237M 83 Linux
/dev/sda2           487424  419917824 419430401  200G 83 Linux
/dev/sda3       3841943552 3883886591  41943040   20G 83 Linux

Command (m for help): 

相关内容