LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-23-2009, 08:57 PM   #1
alirezan1
Member
 
Registered: Nov 2004
Location: Vancouver
Distribution: Ubunty, CentOS ,Mandriva, Gentoo, RedHat, Fedora, Knoppix
Posts: 150

Rep: Reputation: 15
MDADM deletes the disk contents upon initiation?


I have created an LVM partition which has two partitions on it:

Quote:
drwxr-xr-x 4 root root 4096 Feb 23 20:46 .
drwxrwxrwx 11 root root 0 Feb 23 20:46 ..
-rw-r--r-- 1 root root 8 Feb 23 20:46 comp_lvm
drwx------ 2 root root 16384 Feb 23 20:46 lost+found
drwxr-xr-x 2 root root 4096 Feb 23 20:46 testtest
and when I start MDADM RAID-1 with one disk on it:

Quote:
mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/VG1/LVTEST missing
and then I mount the raid disk:

Quote:
$ mount /dev/md0 /mnt/md0/
$ ls /mnt/md0/
lost+found
All the files are gone and when I stop the RAID,

Quote:
$ umount /mnt/md0/
$ mdadm --stop --scan
mdadm: stopped /dev/md0

$ mount /dev/VG1/LVTEST /mnt/LVTEST
$ ls /mnt/LVTEST -la
drwxr-xr-x 3 root root 4096 Feb 23 20:46 .
drwxrwxrwx 11 root root 0 Feb 23 20:50 ..
drwx------ 2 root root 16384 Feb 23 20:46 lost+found

This doesn't sound right. Why are the files gone? aren't they supposed to be in the RAID disk when I start MDADM?

Thanks
 
Old 02-23-2009, 10:16 PM   #2
rtspitz
Member
 
Registered: Jan 2005
Location: germany
Distribution: suse, opensuse, debian, others for testing
Posts: 307

Rep: Reputation: 32
You do realize that running RAID-1 on top of an LVM system doesn't give you any failure protection. You should run LVM on top of RAID1.

Back to your question.

If you create a raid device (dev/md?) some information is written to the raid member devices, which potentially destroys whatever was there before. To create a RAID-1 array from a partition containing data and a new and empty partition of the same size, you'll need to create and start a new RAID-1 device like you did (adding the _new_ empty partition as member 1 of 2), create a filesystem on it, copy the data to it, add the second disk and let it resync. This can be monitored by

Code:
'watch -n 1 /proc/mdstat'.
As far as I know there is _no_ way to move a preexisting filesystem with data into a RAID array and keep the data. You'll always have to copy the data to the array.


Here's a comprehensive tutorial:

http://blog.taggesell.de/index.php?/...RAID-what.html
http://blog.taggesell.de/index.php?/...AID-array.html
http://blog.taggesell.de/index.php?/...ed-drives.html
http://blog.taggesell.de/index.php?/...ing-drive.html
http://blog.taggesell.de/index.php?/...ng-drives.html
http://blog.taggesell.de/index.php?/...AID-array.html

Last edited by rtspitz; 02-23-2009 at 10:18 PM.
 
Old 02-24-2009, 01:37 PM   #3
alirezan1
Member
 
Registered: Nov 2004
Location: Vancouver
Distribution: Ubunty, CentOS ,Mandriva, Gentoo, RedHat, Fedora, Knoppix
Posts: 150

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by rtspitz View Post
You do realize that running RAID-1 on top of an LVM system doesn't give you any failure protection. You should run LVM on top of RAID1.

Back to your question.

If you create a raid device (dev/md?) some information is written to the raid member devices, which potentially destroys whatever was there before. To create a RAID-1 array from a partition containing data and a new and empty partition of the same size, you'll need to create and start a new RAID-1 device like you did (adding the _new_ empty partition as member 1 of 2), create a filesystem on it, copy the data to it, add the second disk and let it resync. This can be monitored by

Code:
'watch -n 1 /proc/mdstat'.
As far as I know there is _no_ way to move a preexisting filesystem with data into a RAID array and keep the data. You'll always have to copy the data to the array.


Here's a comprehensive tutorial:

http://blog.taggesell.de/index.php?/...RAID-what.html
http://blog.taggesell.de/index.php?/...AID-array.html
http://blog.taggesell.de/index.php?/...ed-drives.html
http://blog.taggesell.de/index.php?/...ing-drive.html
http://blog.taggesell.de/index.php?/...ng-drives.html
http://blog.taggesell.de/index.php?/...AID-array.html

Thanks! I do know that running RAID on top of LVM doesn't provide any data protection...it's an experimental system.

Thanks very much, I'll have to go through tutorials.
 
  


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
MDADM fails to hot remove disk alirezan1 Linux - Newbie 8 03-21-2012 10:34 AM
help with mdadm disk failure ufmale Linux - Server 3 05-29-2008 10:59 AM
mdadm : disk replacement jsurles Linux - General 1 12-04-2007 04:20 PM
replace failure disk and rebuild RAID with mdadm ufmale Linux - Software 0 11-15-2007 03:24 PM
RAID-1 with mdadm. Disk fails sometime. jostmart Linux - Server 5 08-15-2007 06:13 AM


All times are GMT -5. The time now is 07:22 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration