TechSpot

RAID question: how can I renew the data in raid array?

By gaehie
Feb 17, 2005
Topic Status:
Not open for further replies.
  1. hello everyone,

    I am thinking to renew the whole data in current raid1 array md0. My environment is:

    raiddev /dev/md0
    raid-level 1
    persistent-superblock 0
    chunk-size 16
    nr-raid-disks 2
    nr-spare-disks 0
    device /dev/hdb1
    raid-disk 0
    device /dev/hdd1
    raid-disk 1

    this '/dev/md0' is /home, so I'm not booting from this disk and the other file systems including root and /boot are on /dev/hda.

    What I want to do is to renew the whole data in /home.

    Is there any way to do this by switching /dev/hdd1 with all new data copied, then sync this new data to the other raid disk (/dev/hdb1) : FROM /dev/hdd1 (the disk just added with new data) TO /dev/hdb1 (currently active raid disk)??

    Usually, after switching the HDD to new one, data in /dev/hdb1 is to be copied to /dev/hdd1 for recovery. But in my case, I want to do the opposite.

    I would be so appreciated by all your helps,
    Thank you,
  2. Nodsu

    Nodsu TS Rookie Posts: 9,431

    I'm not sure what you want to do.. You want to copy something to the /dev/hdd disk (from another computer maybe) and then copy the data from /dev/hdd to the RAID array?

    Since you are using RAID1 then it should be fairly simple.
    You just simulate disk failure by removing /dev/hdd. You could do this by making the hdd drive hdc instead (jumper it to be the secondary master). Now you mount the "hdc" drive (that really was you hdd) and copy whatever you want to /dev/md0.
    Since it's a RAID1 array then all the data that goes to md0 is written to hdb and when the /dev/hdd comes back the RAID is syned onto both disks again.

    I'm not sure if that makes any sense to you. Can't be less obscure than your post though :p
  3. gaehie

    gaehie TS Rookie Topic Starter

    Thank you Nodsu;

    >>You want to copy something to the /dev/hdd disk (from another computer maybe) and then copy the data from /dev/hdd to the RAID array?

    Exactly.. What I want to do is to make a clone copy onto /dev/hdd from another computer. It's the entire /home and it's going to be all new data.

    >>Now you mount the "hdc" drive (that really was you hdd) and copy whatever you want to /dev/md0.

    Since the new data on /dev/hdc(hdd) is to be the entire /home, I am hoping there's any way that I could use that clone copy on hdc(hdd) to be synced to /dev/hdb.. If it's not possible, then boot in rescue mode and delete entire /home on hdb, then copy the new /home, and boot again?

    I'm sorry it might be still obscure...:(
  4. Nodsu

    Nodsu TS Rookie Posts: 9,431

    How are you going to do the cloning?
    You can't really copy the data using RAID synchronisation since RAID wants to see a special RAID bootblock on the disks it uses. So unless the other computer has a RAID setup that looks exactly as your it won't work. Unless you are willing to manually alter the RAID bootblock..

    Assuming the partition sizes match you can do this:
    On the other computer:
    umount /home
    dd if=/dev/bleh of=/dev/blah bs=1m

    bleh is wherever the /home filesystem lives. blah is the hard disk you use to move the data. I suggest you use the entire block device here eg if=/dev/hda of=/dev/hdc

    On your computer
    umount /home
    dd if=/dev/hdc0 of=/dev/md0 bs=1m
    mount /home

    This will copy the contents of /dev/hdc0 to /dev/md0
    Note that here you will use the first partition on the /dev/hdc
  5. gaehie

    gaehie TS Rookie Topic Starter

    Thanks again,,,

    I'm going to use cloning software - TrueImage to duplicate the disk. I've used it before and it worked ok. But I will try dd command that you suggested.

    If I want to start over making (initialize) /dev/md0, should I just delete /etc/raidtab and edit /etc/fstab (so that /dev/md0 won't be mounted), then redo the whole raid setup process again? (--- creat raidtab again and run mkraid and such..).
  6. Nodsu

    Nodsu TS Rookie Posts: 9,431

    Ah! And only now do I realise what you were asking..

    You can do the RAID syncing thing too if you edit the raidtab file so that /dev/hdd is the raid-disk 0 (swap the hdb and hdd lines). It is rather tricky though.
    You can figure out how to do that from here: http://www.tldp.org/HOWTO/Software-RAID-HOWTO-7.html#ss7.6

    No, you don't have to delete /etc/raidtab.. Just unmount /dev/md0, edit raidtab any way you like and run mkraid. You may have to give it some force options so it would agree to overwrite the old array.
  7. gaehie

    gaehie TS Rookie Topic Starter

    >>You can do the RAID syncing thing too if you edit the raidtab file so that /dev/hdd is the raid-disk 0 (swap the hdb and hdd lines).

    I tried over the weekend, and it worked :) Actually what you have mentioned in the very early post was the one I really needed. I didn't have to clone all the stuff, but I just copied some new files/directories on /dev/md0, and synced it. I edited the raidtab to failed-disk then back to raid-disk before copying the file, I'm not sure I did it right but at least it's working now :)

    Thanks for the help!
  8. barb

    barb TS Rookie

    Raid question
    hi, I've joined this thread for info on my puzzling "Via Raid Tool" icon which when opened tells me "some instance of "Via Raid Tool" is already running by another logon user". In my installed programmes is Via Platform Device Manager, I'm not even sure they are the same thing. It is a new computer and since I've had it Norton Security when scanning picks up on a corrupt file which I've finally discovered is this one. Question, Do I need this programme?, What does it do? and can I safely remove it?
    Regards Barb (computer *****)
Topic Status:
Not open for further replies.


Add New Comment

TechSpot Members
Login or sign up for free,
it takes about 30 seconds.
You may also...


Get complete access to the TechSpot community. Join thousands of technology enthusiasts that contribute and share knowledge in our forum. Get a private inbox, upload your own photo gallery and more.