9

So I had a RAID 1 with two hard disk. One hard disk failed, then I replaced it and I reinstalled on this new hard disk a fresh Linux.

Now If I type fdisk -l I get:

root@ns354729:/mnt/sdb2# fdisk -l

Disk /dev/sda: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 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 identifier: 0xbb5259be

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        4096  1495042047   747518976   83  Linux
/dev/sda2      1495042048  1496088575      523264   82  Linux swap / Solaris

Disk /dev/sdb: 750.2 GB, 750156374016 bytes
255 heads, 63 sectors/track, 91201 cylinders, total 1465149168 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: 0x00025c91

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            4096    20975616    10485760+  fd  Linux raid autodetect
/dev/sdb2        20975617  1464092672   721558528   fd  Linux raid autodetect
/dev/sdb3      1464092673  1465144064      525696   82  Linux swap / Solaris

I would like to acces the second hard disk (sdb) so I try to mount sdb2 like this:

mount /dev/sdb2 /mnt

THis says:

root@ns354729:/mnt/sdb2# mount /dev/sdb2 /mnt
mount: block device /dev/sdb2 is write-protected, mounting read-only
mount: you must specify the filesystem type

So I tried to give:

mount -t ext4 /dev/sdb2 /mnt

and I got:

mount: wrong fs type, bad option, bad superblock on /dev/sdb2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

And this says:

root@ns354729:/mnt/sdb2# dmesg | tail
ufs_read_super: bad magic number
VFS: Can't find a romfs filesystem on dev sdb2.
UDF-fs: warning (device sdb2): udf_load_vrs: No VRS found
UDF-fs: warning (device sdb2): udf_fill_super: No partition found (2)
XFS (sdb2): Invalid superblock magic number
(mount,18813,1):ocfs2_fill_super:1038 ERROR: superblock probe failed!
(mount,18813,1):ocfs2_fill_super:1229 ERROR: status = -22
GFS2: not a GFS2 filesystem
GFS2: gfs2 mount does not exist
EXT4-fs (sdb2): VFS: Can't find ext4 filesystem

any help?

3
  • What type of RAID setup? Mirror, stripe... – jc__ Aug 3 '16 at 20:04
  • 1
    Curious why you re-installed Linux on a fresh disk, instead of just adding it to the RAID array and letting mdraid rebuild? – derobert Aug 3 '16 at 20:59
  • I did it, but the os won' boot. The system was stuck at "booting from hard disk" I also tried to reinstall grub with no luck – giò Aug 4 '16 at 6:58
11

You need to assemble the (degraded) RAID array, using something like:

mdadm --assemble --readonly /dev/md0 /dev/sdb2

Of course, pick a number besides md0 if that's already in use. Then you can mount /dev/md0 (or, if it is actually LVM, etc., continue down the chain).

You can, in the case of RAID1, also do this using loopback devices & an offset, but that's much more of a pain, and really is only worth attempting if the mdadm metadata has been destroyed.

3
  • I have tried your command, it says: option --readonly not valid in assemble mode if I remove --readonly it says: /dev/sdb2 has no superblock - assembly aborted smartctl says the hdd is fine. I am not able to recreate this damn superblock. I also followed this to recreate ubuntuforums.org/showthread.php?t=1947275 with no luck – giò Aug 4 '16 at 7:50
  • @giò No superblock? Does mdadm -E /dev/sdb2 say the same thing? sdb is the correct disk, right? – derobert Aug 4 '16 at 15:08
  • Also, looking at your question, that "block device /dev/sdb2 is write-protected, mounting read-only" is rather unexpected if it's a plain ol' hard disk.... you sure that's the right disk? – derobert Aug 4 '16 at 15:10
1

It looks like you have a new 2gig, non-RAID disk and you're trying to read the contents of an old 750gig RAID disk. If that's the case, you can do something like this:

ls -l /dev/md/

In our case, this returned the following:

total 0
lrwxrwxrwx 1 root root 8 Jul 26 08:30 sp:0 -> ../md126
lrwxrwxrwx 1 root root 8 Jul 26 08:30 sp:1 -> ../md127

I was then able to mount the partition I needed for reading:

mount /dev/md/sp:0 /mnt

In the case above, sp:0 and sp:1 I believe are what I named the RAID partitions at the time of creation.

0

I found derobert's answer very helpful, but needed more:

From a new system that had never had an array before with the two drives attached externally via USB drive dock:

  sudo apt update && sudo apt install mdadm -y
  sudo mdadm --examine /dev/sd*
  [output of above command showed two drives that were members of the original raid array, one a PARTITION, the other the entire device]
  sudo mdadm --assemble /dev/md1 /dev/sdb1 dev/sdc --run
  mdadm: /dev/sdb1 is busy - skipping
  mdadm: /dev/md1 assembled from 1 drive - need all 2 to start it (use --run to insist).
  sudo mdadm --assemble /dev/md1 /dev/sdb1 /dev/sdc --run
  mdadm: /dev/sdb1 is busy - skipping
  mdadm: /dev/md1 has been started with 1 drive (out of 2).
  sudo mount /dev/md1 /mnt/md1
  cd /mnt/md1
  ls 
  backup lost+found pictures rsnapshot

I was then able to use rsync to copy the data from the single mounted raid member, /dev/sdc to a verified good drive on a different system.

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.