0

I extended a disk on RHEL 6.9. I am getting superblock error when running resize2fs on the new disk.

This was the previous filesystem layout before resizing:

Disk /dev/sdc: 289.9 GB, 289910292480 bytes
255 heads, 63 sectors/track, 35246 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005b727

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       24316   195311616   83  Linux

This is the filesystem layout after resizing

Disk /dev/sdc: 289.9 GB, 289910292480 bytes
255 heads, 63 sectors/track, 35246 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005b727

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1       35246   283113463+  83  Linux

I deleted the partition /dev/sdc1 only and recreated to extend to the rest of space, I did not write a filesystem on it as we have data on it.

When resizing the filesystem i am getting the error below.

resize2fs 1.41.12 (17-May-2010)
resize2fs: Bad magic number in super-block while trying to open /dev/sdc1
Couldn't find valid filesystem superblock.

I ran the below steps Run fdisk on the right disk (X is the correct letter of your disk): fdisk /dev/sdX Check the partition table by pressing p (to view partition details) Delete the partition by pressing d (to delete the partition) Select the right partition that you want to delete, in most cases will be the only on the disk, so press 1 (to select the partition) Create a new partition by pressing n (to create a new partition) and select the partition type whether Primary (by pressing p) and the right number Get the first block from the partition details in point 2 Press enter to accept the default as the last block. Check the partition table by pressing p (to list the partition and confirm) Save your new partition table Finally, you need to re-read the partition table using this command:

[root@linux ~]# partprobe

Your partition resize is now completed. Note that the partition that you want to resize must be the last one on disk so it can grow contiguously into the free space.

Now it’s the turn of the filesystem inside the partition: you also need to resize it on the extended partition.

First could be useful to check the filesystem. Then you can resize it and this can vary on the filesystem type. For ext3 and ext4 you can use this command:

[root@linux ~]# resize2fs /dev/sdX linux linux-kernel filesystems ext4 parted

Please advise how i can resolve this ?

  • Dumb, question. But this is EXT4 right? Can you try running file -s /dev/sdc1 and checking the filesystem format? – Matthew Ife Jun 22 '19 at 17:29
1

I get the feeling you're assuming its an EXT4 partition and its probably not. You can use a filesystem agnostic option which should work instead.

fsadm resize /dev/sdc1

This should detect and resize no matter the filesystem (provided its one of the common filesystem types). Other than that you can run file -s /dev/sdc1 to see what actual filesystem it is.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.