After shrinking a read only filesystem with resize2fs on GNU/Linux, how do i determine the correct partition entry for the shrunken filesystem?
Initial partition scheme of remote host:
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):
Issuing resize command:
[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.
When recreating the partition entry for /dev/sda2 with 487424 as start sector, and a size of 8 times 52428800 * 512 bytes blocks, does the created partition really cover the whole shrunken filesystem and how can that be proven ?
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):
dumpe2fs -h
. This is also the method used in the answer to this other question (you may even flag your question as a duplicate of that one if you feel yours is answered). Though I couldn't find any reference for the assertion that "Block count" represents the total size of the file system. – fra-san Oct 29 '20 at 16:30