4

I'm trying to resize a Linux partition, but after tweaking a lot with this disk I don't know If I have totally corrupted it.

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdd1  *          64  5913631  5913568  2.8G 17 Hidden HPFS/NTFS
/dev/sdd2        5913632  5915039     1408  704K  1 FAT12
/dev/sdd3        5915040 17578125 11663086  5.6G 83 Linux
/dev/sdd4       17578126 28320312 10742187  5.1G 83 Linux

Using dd deleting partitions and creating new ones I get

Device     Boot    Start      End  Sectors  Size Id Type
/dev/sdd1  *          64  5913631  5913568  2.8G 17 Hidden HPFS/NTFS
/dev/sdd2        5913632  5915039     1408  704K  1 FAT12
/dev/sdd3        5915040 40000000 34084961 16.3G 83 Linux
/dev/sdd4       40000001 62521343 22521343 10.8G 83 Linux

Then following some tutorial I do

 $ e2fsck -f /dev/sdd1
 $ e2fsck 1.43.7 (16-Oct-2017)
 $ ext2fs_open2: Bad magic number in super-block
 $ e2fsck: Superblock invalid, trying backup blocks...


 $ e2fsck: Bad magic number in super-block while trying to open /dev/sdd1

 The superblock could not be read or does not describe a valid ext2/ext3/ext4
 filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
 filesystem (and not swap or ufs or something else), then the superblock
 is corrupt, and you might try running e2fsck with an alternate      superblock:

 e2fsck -b 8193 <device>
  or
 e2fsck -b 32768 <device>

 /dev/sdd1 contains a iso9660 file system labelled 'Kali Live'

(And so on for the rest of the next 3 partitions)

Trying to resize makes the same effect:

$ resize2fs /dev/sdd3
resize2fs 1.43.7 (16-Oct-2017)
resize2fs: Bad magic number in super-block while trying to open /dev/sdd3
Couldn't find valid filesystem superblock.

I've followed a tutorial in internet but is not working, titled: HOWTO: Repair a broken Ext4 Superblock in Ubuntu.

 $ mke2fs -n /dev/sdd4

 $ e2fsck -b block_number /dev/sdd4

 $ e2fsck 1.43.7 (16-Oct-2017)
 e2fsck: Bad magic number in super-block while trying to open /dev/sdd4

The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:

e2fsck -b 8193 <device>
 or
e2fsck -b 32768 <device>

So I definitely run out of ideas of what to do. Is it totally wasted or shall I just reinstall everything from the scratch?

4
  • 1
    sdd1 isn't an ext2 filesystem. it's marked HPFS/NTFS, so I'm not surprised that e2fsck doesn't work on that. For sdd3 and sdd4, you used dd to change your partition table? Jul 17, 2018 at 14:59
  • Yeah exactly I used dd to change the partition table Jul 18, 2018 at 12:21
  • can you show the dd commands you used to alter the partition table? Jul 18, 2018 at 15:25
  • disk /dev/sdd d 4 d 3 n p 3 5915040 17578125 (Do you want to remove the signature?) N n 4 40000001 62521343 N w (writting down the changes) Jul 19, 2018 at 10:20

1 Answer 1

0

Use mke2fs to get the superblock backup:

sudo mke2fs -n /dev/sdaX

sample output:

Super-block backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000

Restart the super-block:

sudo e2fsck -b 32768 /dev/sdaX

If the first one doesn't work try the next until you find a working one. Once done interrupt the operation then run:

sudo fsck -y /dev/sdaX
3
  • Comments are not for extended discussion; this conversation has been moved to chat.
    – Jeff Schaller
    Nov 20, 2021 at 16:12
  • I tried looping through all superblocks using the command below, but it didnt work: list="32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544" IFS=","; for i in $list; do e2fsck -b $i /dev/sda; done
    – alchemy
    Nov 30, 2021 at 1:02
  • 2
    @alchemy if you have a new problem, you should ask it separately. That way, you can spell out the situation and errors you get from your system. Comments are not built for new questions. If you think this answer needs to change, then please explain that (not "it didn't work for me"). Thank you!
    – Jeff Schaller
    Nov 30, 2021 at 1:34

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.