4

Please note that if I resize my partition back to original size with parted, I can then mount my /dev/vda1 partition without problems.

But how can I get it to mount it after I SHRUNK it to 8GB? (there was only 1GB of data on it)

After I shrunk with parted resizepart, when I try to do resize2fs /dev/vda1 it tells me to run e2fsck -f /dev/vda1 first but that always gives error:

:~/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 **********

I can get some backup superblocks but if I try to use any of them with e2fsck -b backupsuperblockNumber /dev/vda1 I get errors...see below paste:

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 **********

And here's current fdisk of partition (after shrinking) 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
  • 2
    Resize the filesystem first, then the partition. Order does matter. – Ipor Sircer Jul 1 '18 at 23:48
  • oh wow good idea, I guess that could work since I'm "shrinking" and not trying to GROW the partition/filesystem. I'm assuming if I was trying to "grow" filesystem then I should "NOT" try to resize filesystem before I enlarge partition to make room for it right? Anyway will try what yousaid:) – htfree Jul 1 '18 at 23:56
  • when I try to resize the 20gb (only 1gb used)I get error: ./resize/resize2fs /dev/vdb1 8GB resize2fs 1.44.1 (24-Mar-2018) ./resize/resize2fs: Invalid new size: 8GB – htfree Jul 2 '18 at 0:17
  • im trying to do a defrag now to see just in case... – htfree Jul 2 '18 at 0:24
  • LoL, that's what happens when you work when not feeling well, head-pressure headache etc, it takes 'G' it doesn't like 'GB' :D guess defragging hopefully didn't hurt – htfree Jul 2 '18 at 0:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.