[ale] Reassembling a software raid array

Greg Freemyer greg.freemyer at gmail.com
Sun Jul 29 16:41:02 EDT 2007


On 7/29/07, John Wells <jb at sourceillustrated.com> wrote:
> Guys,
>
> I have a desktop at home that's been running Ubuntu LTS (Dapper) for some time. I finally got around to upgrading last night. However, I've run into a bit of a complication with my software raid config.
>
> Turns out this box is also my backup dumping group. I had to RAID1 arrays configured:
>
> /dev/hda2 and /dev/sda2 formed a 150GB array, on which I had LVM configured. This was the main "drive" where the OS and /home and /opt partitions lived
>
> /dev/sdc1 and /dev/sdb1 formed a 250 GB array, upon which I had on LVM volume that was mounted on /BACKUP. This is where my "backups" for a few boxes live (yes, I'm aware that raid isn't backup).
>
> When installing Fiesty, I kept running into problems when configuring software raid. On a hunch, I unplugged the drives sdb and sdc, and voila, everything worked. Installed went flawlessly, I was able to replicate the first RAID above and install Fiesty.
>
> So, I'm booted up now, and /dev/md0 is formed for the first array. However, I need to reinitialize my /dev/md1 device with /dev/sdb1 and /dev/sdc1, WITHOUT overwriting or losing data. I would be heartbroken to lose a few files there.
>
> Anyone know how to do this? It would appear that mdadm --assemble should work, but when I try it:
>
> root at box# mdadm --assemble /dev/md1 /dev/sdb1 /deb/sdc1
> mdadm: /dev/md1 is not a block device.
>
> root at box# file /dev/md{0,1}
> /dev/md0: block special (9/0)
> /dev/md1: symbolic link to `md/1'
>
> root at box# mdadm -D /dev/md0
> /dev/md0:
>         Version : 00.90.03
>   Creation Time : Sat Jul 28 23:18:58 2007
>      Raid Level : raid1
>      Array Size : 116238208 (110.85 GiB 119.03 GB)
>     Device Size : 116238208 (110.85 GiB 119.03 GB)
>    Raid Devices : 2
>   Total Devices : 2
> Preferred Minor : 0
>     Persistence : Superblock is persistent
>
>     Update Time : Sun Jul 29 09:04:21 2007
>           State : clean
>  Active Devices : 2
> Working Devices : 2
>  Failed Devices : 0
>   Spare Devices : 0
>
>            UUID : cdd1704f:4e0549a6:3c221302:a751f5d2
>          Events : 0.8
>
>     Number   Major   Minor   RaidDevice State
>        0       3        2        0      active sync   /dev/hda2
>        1       8        2        1      active sync   /dev/sda2
>
> root at box# mdadm -D /dev/md1
> mdadm: md device /dev/md1 does not appear to be active.
>
> Any help (outside of telling me to buy a tape drive ;) ) you can offer will be GREATLY appreciated!
>
> Thanks,
> John

Since this is raid 1, you don't have too much to worry about.

Worst case, if you have an external drive to work with, you can do
something like:

dd if=/dev/sdb1 of=<file-on-external-drive> bs=4k conv=noerror,sync

That will save a complete backup of the physical raw mirror half.

Then recreate your mirror via standard initialization.

Then mount the backup via loopback:

mount -o loop,offset=<offset> <file-on-external-drive> /mnt-point

You will need to try a few different offsets to get it, but it should
be a multiple of 512 I think.  Likely less than or equal to 64k.  If
you can't guess it, you can try to google for it.

Once you have it mounted, just copy all the files back.

Greg
-- 
Greg Freemyer
The Norcross Group
Forensics for the 21st Century



More information about the Ale mailing list