Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-24-2008, 01:05 PM   #1
LQ Newbie
Registered: Feb 2008
Posts: 25

Rep: Reputation: 0
Question How can I verify Raid 1 functionality?

Iím new to linux (not having fun yet) and have been experimenting with software raid1 functionality in hopes of gaining a basic understanding of its concepts and peculiarities. My goal, although useless as it might be, is to set aside 2 small partitions for the raid, leaving the other partitions out of the raid (including the boot partition). This is being done on one disk only.
I would like to run the following test to verify the raid was set up properly, I copied data to /dev/md0 (the raid) and would like to see if the mirrored copies of this data exist, but I donít know how. During the linux install, partitions hda5 and hda6 were designated as the raid partions and have no mount points (as per the [Red Hat] GUI used to partition the disk and set up the raid). Through my web browsing I think I need to break apart the raid and then look at devices hda5 and hda6, but again they have no mount points. So I donít know if this is the right approach. One way or the other there should be 2 copies of identical data lying around somewhere. Does anybody know how to run this type of test?
P.S mdadm is on my system but I donít know of any other raid oriented tools.
Old 02-24-2008, 02:49 PM   #2
harry edwards
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
The following guide includes some commands of interest

It's for Mandriva, but I believe most the commands will apply to other flavors of Linux.
Old 02-24-2008, 03:42 PM   #3
LQ Newbie
Registered: Feb 2008
Posts: 25

Original Poster
Rep: Reputation: 0
Quick Response.
Thanks Harry. There is a lot of information there that I need to review. At first glance it appears that most of the info is geared toward creating the raid1, which I believe I've done. Toward the end there seems to be some discussion about breaking the raid1, which I have done using mdadm, but didn't know how to mount the partitions hda5 and hda6 since they were created with no mount points.
I did not see a discussion for verifying the mirrored data. But as I said, I need to go through your response in more detail. Does your response imply that you feel that breaking the raid is the way to go to verfiy the duplicate data?
Thanks again.

Last edited by l_long_island; 02-25-2008 at 08:16 AM. Reason: correct misspellings
Old 02-24-2008, 09:46 PM   #4
LQ Newbie
Registered: Feb 2008
Posts: 25

Original Poster
Rep: Reputation: 0
Question Looked at Mandriva raid documentation in more detail.

Lots of data to pour through. I don't think the information found in the Mandriva raid documentation is apro-po to my desired test, although this may be a faulty conclusion due to my lack of linux knowledge.
I believe the article talks about a hardware raid. In section 9 there is discussion about testing, however, this consists of copying partition tables and installing the boot loader to a replacement hard disk (after simulating an error on one of the hard disks).
I am hoping to compare data on the two partitions that make up the software raid1 (mirroring). Can this be done or am I not understanding something?
Harry, thanks again for your response.

Last edited by l_long_island; 02-25-2008 at 08:13 AM. Reason: correct misspellings
Old 02-26-2008, 05:32 PM   #5
LQ Newbie
Registered: Feb 2008
Posts: 25

Original Poster
Rep: Reputation: 0
Thumbs up Successful Verification of Software Raid 1 Set-up

Hello all,
Success. Verification of the software raid1 functionality has finally been achieved. I was told that even though the raid partitions were not given mount points during raid creation I could still mount them after the raid was broken. I guess an experienced linux user would have known that. Anyway, the steps I followed to verify that raid 1 did indeed create two separate copies of data are included below. Thanks your help.


Verifying Software Raid1.
Raid1 should result in 2 copies of identical data when writing to the raid. This procedure attempts to verify that 2 copies do indeed exist.
Note this procedure breaks apart the raid and expects the user to re-build the raid, therefore we will try to minimize the changes between the 2 copies of data. There is no guarantee that the minimal changes made here will be transparent to the raid when it is re-established.
Key words: software raid1, verification raid1, testing raid1, duplicate raid1 data

1. Assumptions and terminology (substitute the names used in your raid configuration for the corresponding names used here)
1.1. A software raid 1 configuration has been set up. The OS is Centos 5.1
1.2. The 2 elements to be raided are software partitions (on the same hard disk). On the system tested they are called /dev/hda5 and /dev/hda6
1.3. The logical device name of the raid is /dev/md0 and is mounted to /work_1. This mount point was assigned during raid 1 setup.
1.4. The tool mdadm exists on the linux system. This tool is used to change and determine status of the raid.
1.5. Login as root to avoid privilege violations.
2. Populate the raid with data
2.1. fdisk -l > /work_1/fdisk_output.txt.
2.1.1. I believe you need root privileges to use the fdisk -l option. If this is undesirable you can send the output of a different command to the disk.
2.1.2. I ignored the following message “Disk /dev/md0 doesn’t contain a valid partition table”, which seems to follow every fdisk -l command
3. Ensure that fdisk_output.txt is saved in the format of your text editing tool. I don’t know if this step is needed but I feel it is a good idea. (Optional ?)
3.1. OpenOffice was used to open then save the /work_1/ fdisk_output.txt with no changes.
3.2. Choose “yes”, you want to save in text format.
4. Break apart the raid
4.1. Effectively “fail” one of the partitions (there are 2 dashes preceding the mdadm options, fail, remove and detail)
4.1.1. mdadm /dev/md0 --fail /dev/hda5
4.2. Remove the failed partition from the raid
4.2.1. mdadm /dev/md0 --remove /dev/hda5
4.3. Verify that the raid has been broken (Optional)
4.3.1. mdadm --detail /dev/md0
5. Make the identical files different.
5.1. Create a directory to which we will mount the removed partition
5.1.1. mkdir /home/test_a
5.2. Mount the “removed” partition to the test area
5.2.1. mount /dev/hda5 /home/test_a (root privileges needed?)
5.3. Make a minor modification to file /home/test_a/fdisk_output.txt
5.3.1. OpenOffice was used
5.3.2. The uppercase “D” in line 1 was changed to a lower case “d”
5.3.3. Save the file and accept the changes. Choose “yes”, you want to save in text format
6. Verify that 2 separate files do indeed exist
6.1. Display the file just modified
6.1.1. cat /home/test_a/fdisk_output.txt Note the lower case “d”
6.2. Display the file still part of the degraded raid
6.2.1. cat /work_1/fdisk_output.txt Note the upper case “D”
6.3. Note the time stamp of the 2 files are also different
6.3.1. ls –l /home/test_a/fdisk_output.txt
6.3.2. ls –l /work_1/fdisk_output.txt
7. Re-build the raid (Optional)
7.1. Unmount the removed partition
7.1.1. cd /home (ensures a different location than /home/test_a)
7.1.2. umount /dev/hda5
7.2. Add the removed partition back into the raid
7.2.1. mdadm /dev/md0 --add /dev/hda5
7.3. Interrogate the status of the raid (Optional)
7.3.1. mdadm –detail /dev/md0
7.3.2. Verify the raid has been rebuilt.

You may see the raid an intermediate rebuilding state. Wait approximately 30 seconds and re-issue the interrogate command again. The status should show the raid successfully re-established.

8. Done
Note: The surviving data belonged to /work_1/fdisk_output.txt, the file that resided in the degraded raid. If you were to again break apart the raid, you would notice that both files are now identical and contain the changes in the surviving version (upper case “D”).

Last edited by l_long_island; 02-26-2008 at 05:34 PM. Reason: be more precise


mirroring, raid1, verify

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
Less functionality in 10.1? powadha SUSE / openSUSE 8 05-27-2006 03:59 PM
Need firewall functionality on PC gvaught Linux - Security 6 04-14-2006 09:02 AM
For RAID should I use Quick INIT or Build and Verify? abefroman Linux - Hardware 2 09-23-2005 05:55 PM
verify faulty software raid hard drive jwstric2 Linux - Hardware 0 07-06-2004 10:58 PM
How to verify Raid 0 array? fclifton Linux - Newbie 2 05-03-2004 03:32 PM

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

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