LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MDADM not syncing???? (https://www.linuxquestions.org/questions/linux-newbie-8/mdadm-not-syncing-657066/)

alirezan1 07-20-2008 09:45 PM

MDADM not syncing????
 
Hi there,

I'm new to MDADM. I created an array for RAID1. When I read the contents of /proc/mdstat, it says it's syncing the disks and shows how long till the operation is over. I used /dev/hda3 and /dev/hdb3 to create my array. So, here's my question:

If I create a file on say hda3, shouldn't it be duplicated on to hdb3? Isn't this the whole point? So, if I try to see the contents of the hdb3, shouldn't I be able to see the file duplicated on it?

I created a test file on hda3 and cehcked the contents of hdb3 but I couldn't see anything. Is there anything wrong with what I'm doing?

Thanks all

pinniped 07-20-2008 10:33 PM

After you initially set up a RAID mirror, you need to let the tools do their job.

NEVER individually write to one disk or the other - you will screw up your RAID - always write to the 'md' device to ensure that the data is correctly written to both drives. In a worst case, if a disk failed, mdadm gets confused, and you want to back up your data, mount the drive as read-only. But usually you just replace the bad drive and tell mdadm to 'add' a device to the mirror.

alirezan1 07-20-2008 11:17 PM

Quote:

Originally Posted by pinniped (Post 3221096)
After you initially set up a RAID mirror, you need to let the tools do their job.

NEVER individually write to one disk or the other - you will screw up your RAID - always write to the 'md' device to ensure that the data is correctly written to both drives. In a worst case, if a disk failed, mdadm gets confused, and you want to back up your data, mount the drive as read-only. But usually you just replace the bad drive and tell mdadm to 'add' a device to the mirror.

Alright, it's good to know what's the correct way of doing it :)) damn... Thanks!

So, okay, I mounted my /dev/md0 to /mnt/raid and wrote a file to /mnt/raid. Now this file should be copied to both of my raid disks right? how long would it take? I can't see the file copied after 10 minutes... What's wrong now?

Thanks again

pinniped 07-21-2008 02:39 AM

Can you post the statistics from 'mdadm'? Just to make sure the drives are both used in the one md, etc. At the moment it sounds like the discs are either not synced or else they are not assembled as a RAID.

If you have a software RAID controller, did you set its function to 'normal' (not RAID)? The 'RAID' mode doesn't work with Linux; you need to leave teh disks as 2 separate devices and let Linux handle everything.

After the devices have been synced (which can take many hours), then when a file is copied you should see the duplicate appear in a fairly short time, although a very small file can take a few minutes - just to be sure you can call 'sync' to force the md driver to finish writing things.

alirezan1 07-21-2008 01:47 PM

Quote:

Originally Posted by pinniped (Post 3221218)
Can you post the statistics from 'mdadm'? Just to make sure the drives are both used in the one md, etc. At the moment it sounds like the discs are either not synced or else they are not assembled as a RAID.

If you have a software RAID controller, did you set its function to 'normal' (not RAID)? The 'RAID' mode doesn't work with Linux; you need to leave teh disks as 2 separate devices and let Linux handle everything.

After the devices have been synced (which can take many hours), then when a file is copied you should see the duplicate appear in a fairly short time, although a very small file can take a few minutes - just to be sure you can call 'sync' to force the md driver to finish writing things.

Thanks for your comments. Here's the output of fdisk -l and /proc/mdstat:

sh-3.1# fdisk -l

Disk /dev/hda: 17.1 GB, 17179803648 bytes
16 heads, 63 sectors/track, 33288 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 9688 4882720+ 83 Linux
/dev/hda2 9689 13563 1953000 82 Linux swap / Solaris
/dev/hda3 13564 23251 4882752 83 Linux
/dev/hda4 23252 32939 4882752 83 Linux

Disk /dev/hdb: 17.1 GB, 17179803648 bytes
16 heads, 63 sectors/track, 33288 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 9689 4883224+ 83 Linux
/dev/hdb2 9690 10659 488880 82 Linux swap / Solaris
/dev/hdb3 10660 20348 4883256 fd Linux raid
autodetect
/dev/hdb4 20349 30037 4883256 fd Linux raid
autodetect

Disk /dev/md0: 5000 MB, 5000445952 bytes
2 heads, 4 sectors/track, 1220812 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 500 MB, 500604928 bytes
2 heads, 4 sectors/track, 122218 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md1 doesn't contain a valid partition table
sh-3.1# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 hda4[1] hda3[0]
488872 blocks super 1.0 [2/2] [UU]

md0 : active raid1 hdb4[1] hdb3[0]
4883248 blocks super 1.0 [2/2] [UU]

unused devices: <none>



I just don't konw why I keep getting "Disk /dev/md0 doesn't contain a valid partition table" error message. I formatted the drive with mkfs.ext3 when I created it too but it keeps giving this error message.

help!!!

Thanks

alirezan1 07-21-2008 01:48 PM

Quote:

Originally Posted by pinniped (Post 3221218)
Can you post the statistics from 'mdadm'? Just to make sure the drives are both used in the one md, etc. At the moment it sounds like the discs are either not synced or else they are not assembled as a RAID.

If you have a software RAID controller, did you set its function to 'normal' (not RAID)? The 'RAID' mode doesn't work with Linux; you need to leave teh disks as 2 separate devices and let Linux handle everything.

After the devices have been synced (which can take many hours), then when a file is copied you should see the duplicate appear in a fairly short time, although a very small file can take a few minutes - just to be sure you can call 'sync' to force the md driver to finish writing things.

Thanks for your comments. Here's the output of fdisk -l and /proc/mdstat and mount:

Quote:

sh-3.1# fdisk -l

Disk /dev/hda: 17.1 GB, 17179803648 bytes
16 heads, 63 sectors/track, 33288 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 9688 4882720+ 83 Linux
/dev/hda2 9689 13563 1953000 82 Linux swap / Solaris
/dev/hda3 13564 23251 4882752 83 Linux
/dev/hda4 23252 32939 4882752 83 Linux

Disk /dev/hdb: 17.1 GB, 17179803648 bytes
16 heads, 63 sectors/track, 33288 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 9689 4883224+ 83 Linux
/dev/hdb2 9690 10659 488880 82 Linux swap / Solaris
/dev/hdb3 10660 20348 4883256 fd Linux raid
autodetect
/dev/hdb4 20349 30037 4883256 fd Linux raid
autodetect

Disk /dev/md0: 5000 MB, 5000445952 bytes
2 heads, 4 sectors/track, 1220812 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md0 doesn't contain a valid partition table

Disk /dev/md1: 500 MB, 500604928 bytes
2 heads, 4 sectors/track, 122218 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md1 doesn't contain a valid partition table
sh-3.1# cat /proc/mdstat
Personalities : [raid1]
md1 : active raid1 hda4[1] hda3[0]
488872 blocks super 1.0 [2/2] [UU]

md0 : active raid1 hdb4[1] hdb3[0]
4883248 blocks super 1.0 [2/2] [UU]

unused devices: <none>

sh-3.1# mount
/dev/root on / type ext2 (rw)
/ramdisk on /ramdisk type tmpfs (rw,size=242880k,mode=755)
/UNIONFS on /UNIONFS type aufs (rw,br:/ramdisk:/KNOPPIX)
/dev/hdc on /cdrom type iso9660 (ro)
/dev/cloop on /KNOPPIX type iso9660 (ro)
/proc/bus/usb on /proc/bus/usb type usbfs (rw,devmode=0666)
/dev/pts on /dev/pts type devpts (rw)
/dev/hda1 on /mnt/hdinstall type reiserfs (rw)
/dev/md0 on /mnt/raid0 type ext3 (rw)
/dev/md1 on /mnt/raid1 type ext3 (rw)

I don't konw why I keep getting "Disk /dev/md0 doesn't contain a valid partition table" error message. I formatted the drive with mkfs.ext3 when I created it too but it keeps giving this error message.


I also still can't get why I can't see the files written to disks when I write to the raid0 or raid1.

help!!!

Thanks


All times are GMT -5. The time now is 03:26 PM.