如何调整我用parted缩小的2fs ext4分区的大小,而无需e2fsck -f抱怨超级块或分区表

如何调整我用parted缩小的2fs ext4分区的大小,而无需e2fsck -f抱怨超级块或分区表

请注意,如果我使用parted将分区大小调整回原始大小,则可以毫无问题地挂载我的/dev/vda1分区。

但是在我把它SHRUNK到8GB之后我怎样才能让它挂载呢? (上面只有1GB数据)

在我使用parted resizepart缩小之后,当我尝试执行resize2fs /dev/vda1时,它告诉我首先运行e2fsck -f /dev/vda1,但总是给出错误:

:~/e2fsprogs-1.44.1# ./e2fsck/e2fsck -f /dev/vda1
e2fsck 1.44.1 (24-Mar-2018)
The filesystem size (according to the superblock) is 5214459 blocks
The physical size of the device is 1924709 blocks
Either the superblock or the partition table is likely to be corrupt!
Abort<y>? cancelled!

rootfs: ********** WARNING: Filesystem still has errors **********

我可以获得一些备份超级块,但如果我尝试使用 e2fsck -b backupsuperblockNumber /dev/vda1 中的任何一个,我会收到错误......请参阅下面的粘贴:

Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

:~/e2fsprogs-1.44.1# ./e2fsck/e2fsck -b 32768 /dev/vda1
e2fsck 1.44.1 (24-Mar-2018)
rootfs: recovering journal
./e2fsck/e2fsck: unable to set superblock flags on rootfs

rootfs: ***** FILE SYSTEM WAS MODIFIED *****
rootfs: ********** WARNING: Filesystem still has errors **********

这是分区当前的 fdisk(缩小后) fdisk -l /dev/vda1

Disk /dev/vda1: 7.4 GiB, 7883608576 bytes, 15397673 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

sfdisk -d /dev/vda > sfdiskDump
:~/e2fsprogs-1.44.1# cat sfdiskDump
# partition table of /dev/vda
unit: sectors

/dev/vda1 : start=        1, size= 41943039, Id=ee
/dev/vda2 : start=        0, size=        0, Id= 0
/dev/vda3 : start=        0, size=        0, Id= 0
/dev/vda4 : start=        0, size=        0, Id= 0

And gdisk:
Found valid GPT with protective MBR; using GPT.
Disk /dev/vda: 41943040 sectors, 20.0 GiB
Logical sector size: 512 bytes
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 41943006
Partitions will be aligned on 2048-sector boundaries
Total free space is 26320020 sectors (12.6 GiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1          227328        15625000   7.3 GiB     8300
  14            2048           10239   4.0 MiB     EF02
  15           10240          227327   106.0 MiB   EF00

相关内容