Bad magic number in superblock external HDD [duplicate]
I have an external HDD that appears to be broken. Cannot be opened in Windows nor in Ubuntu (it is a NTFS file system). On Windows I have run (two times now) the command chkdsk . There it identifies certain memory segments which are unreadable. I thought that it would ‘flag’ these, and avoid them while trying to read in the HDD. But after I ran that program, Windows was still unable to open it. So either I am wrong, or my disk is beyond repair. Assuming that I am wrong, I turned to Ubuntu to see if gparted or fsck could be of any help. The ‘check’ function in gparted gave me an error. and not much additional information. First checking where the partition is, running lsblk gives
sdb 8:16 0 298,1G 0 disk └─sdb1 8:17 0 298,1G 0 part
root@. # fsck /dev/sdb1 -y fsck from util-linux 2.31.1
Nothing more. So that was quite strange. Therefore I tried the whole disk and not one partition. This gave
root@. # fsck /dev/sdb -y fsck from util-linux 2.31.1 e2fsck 1.44.1 (24-Mar-2018) ext2fs_open2: Bad magic number in super-block fsck.ext2: Superblock invalid, trying backup blocks. fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb 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 or e2fsck -b 32768 Found a dos partition table in /dev/sdb
fsck.ext2: Bad magic number in super-block while trying to open /dev/sdb
Since I am sure (thanks to gparted ) that I am dealing with an ntfs file system, and not ext5 .. I think that the proposed solution (running ef2fsck is not applicable to me. I don’t know how to continue from here. I believe if certain memory segments can be avoided to read in.. I think I can retrieve some data from it. But I don’t know how to do this.
Resizing a partition in Linux — Bad magic number in super-block error
Unfortunately I can’t understand why this doesn’t work. It was an ext4 partition. I would like to resize the partition without loss of data.
fdisk list before operation: Device Boot Start End Blocks Id System /dev/sda1 * 4096 40962047 20478976 83 Linux /dev/sda2 40962048 975718399 467378176 83 Linux /dev/sda3 975718400 976764927 523264 82 Linux swap / Solaris Now fdisk shows: Device Boot Start End Blocks Id System /dev/sda1 * 4096 40962047 20478976 83 Linux /dev/sda2 80078848 975718399 447819776 83 Linux /dev/sda3 975718400 976764927 523264 82 Linux swap / Solaris
excuse me didn’t you forget to create the file system on the new partittion: mkfs.ext4 /dev/sda2 and then try resizing, i am sure it will work
yeah but unfortunately you lost your data the minute you typed rm 2. it is not possible to resize a partition that has no filesystem like the partition you are trying to resize, you are getting the error bad magic number because resiserfx could not find the superblocks.
2 Answers 2
First, I’d like to be very clear on an important distinction:
- Partitions are simply pointers to where filesystems begin and end. On modern disks, these start and end points are expressed as sector values.
- Filesystems are complex data structures that reside within partitions (or other containers). Typically, filesystems are defined relative to the start point of the containing partition.
Your /dev/sda2 used to begin at sector 40,962,048. You changed it so that it now begins at sector 80,078,848. Thus, the critical early parts of the filesystem now begin outside the partition. An analogy might be if you somehow moved the front cover of a reference book, sitting flat on a table, a centimeter or so down without moving any of the pages of the book. When you opened the book, you’d find that the table of contents was missing, along with the first chapter or two. Those pages would now be floating freely, extracted from the book. You’d therefore be unable to find anything in the book except by reading the whole thing — and even then, parts of it would be missing.
Generally speaking, any partitioning operation that involves moving or resizing the start of a partition is best done using GParted, which knows the proper order of operations for moving and resizing partition and filesystem data structures to keep everything working properly. Even GParted is not without its risks when resizing partitions, though — especially not when the start point is involved, since this requires moving significant amounts of data, so a bug, power failure, hardware fault, or other problem can end up trashing the whole partition. If you must do it without GParted, you can, but you have to fully understand the distinction between a partition and a filesystem that I’ve outlined, and understand the implications of this distinction for the order in which you perform various operations (resize filesystem, move filesystem, change partition boundaries).
In your specific case, what I recommend is:
- Delete your new /dev/sda2 .
- Re-create your /dev/sda2 using its original start and end sector values. Be sure these are exactly the same as they were before.
- Check that the re-created /dev/sda2 is accessible.
- Back up your important data from /dev/sda2 .
- Re-evaluate whether you really need to move the start of the partition. I don’t know what your ultimate goal is, so I can’t do this for you. Perhaps moving the end point would work as well (and that would be safer); or maybe adding another disk would be a better option; or maybe you don’t really need to repartition at all.
- If you must repartition the disk, use GParted to do the job.
tune2fs: Bad magic number in super-block while trying to open /dev/sdb1
I am experiencing the above problem and I have no idea what caused this. Can someone help me figure this out? 1) I have already had my first disk /dev/sda working properly, now I am trying to create another FS on the 2nd disk: $fdisk /dev/sdb [I pressed n, p, w under fdisk] 2) I took a look at the result of fdisk
$fdisk -l Disk /dev/sda: 1999.0 GB, 1998998994944 bytes 255 heads, 63 sectors/track, 243031 cylinders, total 3904294912 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 Disk identifier: 0x000a6eb5 Device Boot Start End Blocks Id System /dev/sda1 * 2048 1953124351 976561152 83 Linux /dev/sda2 1953126398 2070310911 58592257 5 Extended /dev/sda5 1953126400 2070310911 58592256 82 Linux swap / Solaris Disk /dev/sdb: 1999.0 GB, 1998998994944 bytes 31 heads, 7 sectors/track, 17992142 cylinders, total 3904294912 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 Disk identifier: 0x49802e7d Device Boot Start End Blocks Id System /dev/sdb1 2048 3904294911 1952146432 83 Linux
$ mkfs.xfs -i size=1024 /dev/sdb
$tune2fs -l /dev/sdb1 |grep -i inode tune2fs: Bad magic number in super-block while trying to open /dev/sdb1 Couldn't find valid filesystem superblock.
Linux — new hard drive, bad magic number in superblock
SOLUTION: For all of the things that were right, making the volume with fsck and making the filesystem with mkfs are two separate operations. Thanks for giving me nice, descriptive, helpful error messages, Linux. 😀
fsck.ext2: Bad magic number in super-block while trying to open /dev/sda The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 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
That error occurred when running sudo fsck /dev/sda on a brand new drive. I ran sudo fdisk /dev/sda and added a new partition (just accepted the defaults here) but I got a corresponding magic number error when trying to mount it. I tried alternate blocks (using superblocks listed by sudo mkfs -n /dev/sda ) but none worked, they were all listed as being corrupt. I’m looking for a way to solve this, especially considering it’s a brand new drive, never partitioned. Addendum 1: After this failed, I dd ‘d the entire disk with zeroes, then used fdisk and noted it had no partitions. I added a partition in fdisk (accepting the defaults). In fdisk , partitions are listed as follows:
Command (m for help): p Disk /dev/sda: 2000.4 GB, 2000398934016 bytes, 3907029168 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 Disk label type: dos Disk identifier: 0x639543e8 Device Boot Start End Blocks Id System /dev/sda1 2048 3907029167 1953513560 83 Linux
[user@localhost ~]$ sudo mount /dev/sda1 drivefolder/ mount: wrong fs type, bad option, bad superblock on /dev/sda1, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so.
[17467275.127319] ata9.00: configured for UDMA/133 [17467275.127325] ata9.00: device reported invalid CHS sector 0 [17467275.127332] ata9: EH complete [17594695.132437] sda: sda1
fsck from util-linux 2.23.1 e2fsck 1.42.7 (21-Jan-2013) ext2fs_open2: Bad magic number in super-block fsck.ext2: Superblock invalid, trying backup blocks. fsck.ext2: Bad magic number in super-block while trying to open /dev/sda The superblock could not be read or does not describe a correct ext2 filesystem. If the device is valid and it really contains an ext2 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
Since this was a new drive, and I also dd ‘d the entire drive to zeroes, I’m at a loss to fix it. It’s reproducible and so far the solutions I’ve seen involve using the fsck -b option, but I’ve tried it with all of the backup superblocks given by mkfs and none of them have worked.
Восстановление Ext4 Superblock linux.
Ваш компьютер не загружается, проверка файловой системы говорит Вам что у Вас имеется bad superblock, и Вы не видите решения проблемы.
В данном руководстве используется файловая система ext4. Простейший путь для решения проблем с загрузкой компьютера, это использовать Parted Magic. Загружаемся в него с загрузочной флешки. Подробнее, как это сделать, ищем в интернете.
1. Для начала, необходимо найти наш сломанный раздел командой:
Данная команды выведет список всех разделов на всех дисках вашего компьютера. Для восстановления потерянного раздела можно воспользоваться утилитой Testdisk. Testdisk содержится в дистрибутиве Parted Magic, и на их сайте есть хороший раздел помощи.
2. Получив список разделов ищем проблемный superblock, запустим проверку файловой системы, заменив xxx на номер раздела. Возможно необходимо изменить тип файловой системы ext4 на ext3, или ext2:
Если ваш superblock поврежден, вывод команды будет примерно следующего содержания:
fsck /dev/sda5 fsck 1.41.4 (27-Jan-2009) e2fsck 1.41.4 (27-Jan-2009) fsck.ext4: Group descriptors look bad. trying backup blocks. fsck.ext4: Bad magic number in super-block while trying to open fsck /dev/sda5 fsck 1.41.4 (27-Jan-2009) e2fsck 1.41.4 (27-Jan-2009) fsck.ext4: Group descriptors look bad. trying backup blocks. fsck.ext4: Bad magic number in super-block while trying to open /dev/sda5 The superblock could not be read or does not describe a correct ext4 filesystem. If the device is valid and it really contains an 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
3. Попробуем найти где находится бекап superblock.
Вывода данной команды должен показать список бекапов:
Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
4. Наконец восстановим superblock из бекапа, опять же заменив xxx на номер вашего раздела, и block_number на первый superblock в списке бекапов.
# e2fsck -b block_number /dev/xxx
5. Перезагружаем компьютер и ваш superblock должен быть восстановлен. Если этого не произошло, попробуйте повторить шаги, но восстанавливать со следующего бекапа.