LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 12-11-2010, 02:18 PM   #1
BinWondrin
Member
 
Registered: Jun 2008
Distribution: Fedora, RHEL, Ubuntu
Posts: 33

Rep: Reputation: 15
recreate raid-5 array w/o loosing data


I rebuilt a server and am now trying to recover my large data arrays.
The server was ubuntu 10.04lts before.
I decided to rebuild it with CentOS simply because I am more familiar with it.
I had 2 raid-5 arrays on the old server:
  • 4 x 1tb -> md0
  • 5 x 2tb -> md1
The newly built server does not know about these arrays yet.
How can I reassemble the arrays without loosing my data?
I know the data can still be accessed because booting the server with a live-cd mounts and shows the arrays just fine.
Should I boot with a live cd and copy the mdadm config file?

Thanks in advance.

BinWondrin
;-)
 
Old 12-11-2010, 02:24 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
The live CD probably just runs dmraid -ay.
Code:
dmraid -ay
Regarding the "...without losing data..." part I recommend ensuring that you have an up to date backup before doing anything else. Mr. Murphy is always looking for an opportunity to mess you up. Since the live CD will assemble the arrays properly you could use that to make your backups if you don't already have them.

Last edited by stress_junkie; 12-11-2010 at 02:31 PM.
 
Old 12-11-2010, 02:32 PM   #3
BinWondrin
Member
 
Registered: Jun 2008
Distribution: Fedora, RHEL, Ubuntu
Posts: 33

Original Poster
Rep: Reputation: 15
Thank you. I gave it a shot and here is what I get:

These are the devices:
Quote:
Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdc: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdd: 2000.3 GB, 2000398934016 bytes
Disk /dev/sde: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdf: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdg: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdh: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdi: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdj: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdb: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdc: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdd: 2000.3 GB, 2000398934016 bytes
Disk /dev/sde: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdf: 2000.3 GB, 2000398934016 bytes
Disk /dev/sdg: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdh: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdi: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdj: 1000.2 GB, 1000204886016 bytes
Here is the return from dmraid -ay:
Quote:
dmraid -ay
ddf1: virtual drives with CRC 466DCCE2, expected 866C0109 on /dev/sda
ddf1: physical drives with CRC EA982444, expected 8A877121 on /dev/sda
ddf1: VD CFG with CRC F4AB4282, expected 981107F1 on /dev/sda
ddf1: VD CFG with CRC EA90F2, expected ECF124FA on /dev/sda
ERROR: ddf1: cannot find virtual drive record on /dev/sda
ERROR: ddf1: wrong # of devices in RAID set "ddf1_SYSTEM" [1/4] on /dev/sda
RAID set "ddf1_SYSTEM" already active
The dynamic shared library "libdmraid-events-ddf1.so" could not be loaded:
libdmraid-events-ddf1.so: cannot open shared object file: No such file or directory
ERROR: dos: reading /dev/mapper/ddf1_SYSTEM[No such device or address]
 
Old 12-11-2010, 02:34 PM   #4
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
That's unfortunate.

You should definitely ensure that you have a good backup of the data before proceeding.

Do you have a backup of the mdadm config file from the original system?
 
Old 12-11-2010, 03:20 PM   #5
BinWondrin
Member
 
Registered: Jun 2008
Distribution: Fedora, RHEL, Ubuntu
Posts: 33

Original Poster
Rep: Reputation: 15
O.K. - I figured it out:

mdadm will do it if supplied with the correct original raid device name followed by the devices that form ther array:
Quote:
mdadm --assemble /dev/md0 /dev/sdg /dev/sdh /dev/sdi /dev/sdj
mdadm: /dev/md0 has been started with 4 drives.
[root@megastorix ~]# mdadm --assemble /dev/md1 /dev/sdb /dev/sdc /dev/sdd /dev/sde /dev/sdf
mdadm: /dev/md1 has been started with 5 drives.
[root@megastorix ~]# cat /proc/mdstat Personalities : [raid6] [raid5] [raid4]
md1 : active raid5 sdb[0] sdf[5] sde[3] sdd[2] sdc[1]
7814057472 blocks super 1.2 level 5, 128k chunk, algorithm 2 [5/5] [UUUUU]

md0 : active raid5 sdg[0] sdj[4] sdi[2] sdh[1]
2930287104 blocks super 1.2 level 5, 128k chunk, algorithm 2 [4/4] [UUUU]

unused devices: <none>
 
Old 12-11-2010, 03:42 PM   #6
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 331Reputation: 331Reputation: 331Reputation: 331
Thank you for posting the answer and for marking the thread "solved".
 
Old 09-10-2012, 08:09 PM   #7
mwtzzz
LQ Newbie
 
Registered: Sep 2012
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by BinWondrin View Post
ERROR: ddf1: cannot find virtual drive record on /dev/sda
Before doing anything, you gotta make sure all previous RAID metadata is erased from disk. "dmraid remove_all" does not erase it.

The DDF1 array stores metadata at the end of the hard drive. One way to erase it is to zero out the entire hard drive, but that could take too much time depending on size.

Another way, is to find out where the metadata is stored. You can do this in Linux by running "strace dmraid -c -s > /tmp/out 2>&1". Look at the output file for "lseek" which will give you the byte offset of the metadata. The metadata is stored in a bunch of different sectors, so "lseek" will appear a bunch of times, just find the smallest byte offset and use "dd" to zero the data from that point forward.
 
  


Reply


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
recreate md-raid edgjerp Linux - Hardware 3 05-01-2008 04:45 PM
Sending Raid Array Data through postfix ajferrari Linux - Newbie 2 01-12-2007 11:33 PM
Howto UNinstall software RAID 1 without loosing data carlosruiz Linux - General 1 05-28-2006 09:10 PM
From Xp to Linux without loosing my RAID array ? Epsilum Linux - Newbie 4 03-01-2006 02:54 PM
Help accessing data on NTFS raid array Qwindelzorf Linux - Hardware 2 01-15-2005 02:34 PM


All times are GMT -5. The time now is 08:46 AM.

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