1

I clone single disk systems by booting the master system to a CD and running…

dd if=/dev/sda | gzip - | ssh user@hostname dd of=image.gz

Then I boot the target system with the CD and run…

ssh user@hostname dd if=image.gz | unzip - | dd of=/dev/sda

I works great for simple single disk systems.

But now I'd like to perform a similar cloning of a 4 disk RAID5 system. I know that /dev/sda needs to change, but to what?

EDIT: The boxes are linux each with a software RAID.

dacracot
  • 469
  • 2
  • 13
  • 28
  • I usually tell people not to do this, because I can't think of a use case where it is the best course outside of USB FLASH or SD card imaging. If it is hardware raid (which I assume is true), is the raid already set up on the destination machine? If so, just do the same thing with the hardware raid device. If it is software raid, do it 4 times, one for each disk. – Andrew Domaszek Nov 21 '14 at 21:13
  • Are you trying to back up individual drives or the RAID volume? If you back up the individual drives, you'll be expanding the information you store by the amount of parity that's kept on the drives. The best answer really depends on what it is that you're trying to accomplish. What are you trying to accomplish with this clone? Backup? Migration? Offline analysis? Environment duplication? – austinian Nov 21 '14 at 23:03

2 Answers2

1

Trying to clone the underlying partitions/drives used by the RAID will probably just result in problems.

I would probably follow a procedure like this.

  • On the original server
    • Boot your livecd/rescue environment
    • Make sure your RAID volumes are started.
    • Backup any filesystems/devices that are not part of your RAID volume (like your /boot)
    • Use DD to make a backup the block devices for your arrays.
  • On the Destination
    • Boot your livecd/rescue environment
    • Issue the required partitioning commands and mdadm commands to create the required filesystems and setup a RAID volume similar to the source server
    • Restore all volume backups to their respective locations.
    • Finally mount the filesystems and correct your /etc/mdadm/*, /etc/fstab, and any other configuration files that reference the UUID of the original array.
Zoredache
  • 130,897
  • 41
  • 276
  • 420
0

The name of the device depends upon the raid implementation. It might even be /dev/sda if you are running a hardware raid.

If you really don't know the name of the device you might get a hint by looking at /etc/fstab or the output of fdisk -l. However, those file and command assume a Linux system, you might need other file or command on other systems. If you are using Solaris the name of the file is probably /dev/vfstab instead.