Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

A short backstory: something happened on my Synology NAS, apparently a buggy mailserver program that came with an update stopped the device from seeing the 2x3TB drives I have. After a lot of searching and a trying a lot of different solutions I eventually got the drives to show up again but they would not mount. After struggling, I figured that, because it was set up as a mirror, I could format one drive, mount it and perform the recovery on the other.

EDIT: I had it wrong and was trying to mount the wrong disk (not used to messing around with raid), however, I'm still unable to mount the correct disk, sda

$ file -s /dev/sda1
/dev/sda1: data
$ mount -t ext4 /dev/sda1 /mnt               
mount: mounting /dev/sda1 on /mnt failed: Invalid argument

Further Info

$ cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / ext4 rw,relatime,barrier=0,journal_checksum,data=ordered 0 0
/proc /proc proc rw,relatime 0 0
/tmp /tmp tmpfs rw,relatime 0 0
none /dev/pts devpts rw,relatime,gid=4,mode=620 0 0
/sys /sys sysfs rw,relatime 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
/dev/vg1000/lv /volume1 ext4 rw,relatime,synoacl,barrier=0,journal_checksum,data=writeback,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group 0 0
/dev/vg1000/lv /opt ext4 rw,relatime,synoacl,barrier=0,journal_checksum,data=writeback,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group 0 0
share|improve this question
    
Let's start with two simple things, first, ls -l /dev/md3. Second, grep /mnt /proc/mounts. And a third thing, a little less simple, do those mount lines add any kernel messages (dmesg)? –  derobert Nov 29 '12 at 15:57
    
Another simple thing: do you have the /mnt directory created? –  atroon Nov 29 '12 at 15:59
    
(And, also, for anyone else who hits a similar problem: mkfs is seldom, nay, almost never the right way to recover from a raid failure.) –  derobert Nov 29 '12 at 16:01
    
Yes, the /mnt directory exists. @derobert: first gives me brw-rw---- 1 root root 9, 3 Jan 18 2006 /dev/md3, second is nothing and third, there's no messages in dmesg pertaining to the failed mount. –  Andy E Nov 29 '12 at 16:02
    
@AndyE What is in /proc/mounts? Trying to figure out where the busy message came from (makes it sound like its already mounted somewhere...) –  derobert Nov 29 '12 at 16:05
show 6 more comments

1 Answer

up vote 8 down vote accepted
+200

This is an attempt to summarize from the chat troubleshooting session.

The setup turns out to be physical disk -> mdraid raid1 -> LVM. So there are several layers to work through. The old setup was (due to unfortunate prior recovery efforts) not available.

However, the NAS gui had been used to create another volume on a different disk, and thankfully the GUI created the new volume exactly the same way. So it was possible to discover the setup from the new disk:

  • mdadm -E new-disk provided the offset to the start of the data, under the mdraid layer (2048 sectors).
  • dmsetup table provided the start block of the logical volume (relative to the start of the physical volume) (1152 sectors)
  • There is a magic number (0x53ef) in the third sector of an ext4 volume. Using dd and xxd, we verified that the magic number is present at that offset on the disk we're trying to recover data from.

Armed with the start sector of the ext4 filesystem, you can use a read-only loop device to recover the data:

# losetup /dev/loop0 -o $((512*(1152+2048))) -r /dev/sda1
# mount -text4 -o ro /dev/loop0 /mnt

And then copy it off.

share|improve this answer
    
Once again, thank you for the amount of time and effort you put into helping me. You must have the patience of a saint. –  Andy E Nov 30 '12 at 19:26
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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