LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-29-2009, 05:01 PM   #1
Voltar
Member
 
Registered: Jan 2006
Location: Bakersfield, California
Distribution: CentOS 5.3, FreeBSD 7.2, Fedora 11
Posts: 83

Rep: Reputation: 15
mdadm assemble raid5 with loopback mounted disk images


I have an old RAID 5 array that was comprised of three 320 GB IDE Western Digital drives. Currently one of the old drives is completely toast, an another is questionable. I have a full image of the questionable drive (299 GiB) that I dd'd, and I have the third drive that is still working. My goal is to get mdadm to assemble the array in a degraded state, long enough for me to copy all the data that is still on there somewhere else.

I started with dd'ing an full image of the questionable drive to an image file:

Quote:
# dd if=/dev/sdp of=/home/drive.img
Then I mounted the image file via losetup:

Quote:
# losetup /dev/loop0 /home/drive.img
Attempting to now use /dev/loop0 in the assembly yeilds this:

Quote:
# mdadm -A /dev/md17 /dev/sdp1 /dev/loop0
mdadm: no RAID superblock on /dev/loop0
mdadm: /dev/loop0 has no superblock - assembly aborted
After that I realized that I dd'd the entire drive not just the main partition. So using fdisk to find out the partition table yeilds this:

Quote:
# fdisk -l /dev/loop0

Disk /dev/loop0: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/loop0p1 1 38913 312568641 fd Linux raid autodetect
Seemingly normal and all is working so far. So trying to assemble the array with the following also fails:

Quote:
# mdadm -A /dev/md17 /dev/sdp1 /dev/loop0p1
mdadm: cannot open device /dev/loop0p1: No such file or directory
mdadm: /dev/loop0p1 has no superblock - assembly aborted
Any suggestions? I know it would be a lot easier to hook both drives up and attempt to start the degraded array that way, but the server I'm working with has no IDE channels, and I only have one USB adapter.

Thanks in advance for any help
 
Old 06-11-2011, 01:20 PM   #2
int0x80
Member
 
Registered: Sep 2002
Location: Cincinnati
Distribution: Debian GNU/Linux
Posts: 310

Rep: Reputation: 31
Lightbulb Offset

Sorry to rez an old thread, just wanted to post some info as I was playing with this today.

The Linux raid autodetect partition (0xfd) in the image may be at an offset so you need to use losetup with the offset.

1. Find the offset:
Code:
# parted drive.img
(parted) unit b
(parted) print
Number  Start     End        Size       Type     File system  Flags
 1      1048576B  98703359B  97654784B  primary               raid
2. Create the loopback with the offset:
Code:
# losetup -o 1048576 /dev/loop0 drive.img
3. Continue with your RAID setup
 
  


Reply

Tags
loopback, mdadm, raid


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't create partition on mdadm raid5 and images mounted over loopback emat Linux - Software 2 06-11-2011 01:23 PM
mdadm array doesn't assemble seaking1 Linux - Software 8 03-06-2009 09:34 AM
mdadm clean install of four drives overwritting any previous raid5 disk array javaholic Linux - Server 15 10-13-2008 11:05 AM
mdadm, images over loopback, raid5, can't create partitions emat Linux - Software 1 05-03-2007 03:46 PM


All times are GMT -5. The time now is 12:24 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration