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 pressingp
) and the right numberGet 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 ?