[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 724
  • Last Modified:

clone a linux drive

What is the best way to clone a mirrored drive?

I have a server built that runs on mirrored drives. I have 10 more servers that I want identical to it?  Should I pull the drives out of the extra 10 and put them in my first system, then run dd?  Will dd let me copy a drive that I'm running from?

http://www.backuphowto.info/linux-backup-hard-disk-clone-dd

That is what I'm thinking of trying.  Is this the best way to do it?  The OS is Ubuntu.
0
md168
Asked:
md168
3 Solutions
 
robthewolfCommented:
I would use dd too.  It will make identical copies of the data on the disks.  
When you say you have mirrored drives do you main some sort of raid?  
I am going to assume you have 11 servers each with two disks in.  
the first server is installed how you want it and the mirrored drive is an exact copy of the master.
pull 1 drive out of each system and use dd to copy the data from your original master to a new disk.
once you have it copied place it in its original machine (server 2) and check that its working and the raid is mirroring it.  You shouldnt need to copy the second drive as the raid software/ hardware should handle it.  once you have two machine up and running i you can copy in parallel
0
 
torimarCommented:
The Linux 'dd' command is extremely powerful and, since it does not ask for a confirmation to overwrite any kind of device with any kind of data, extremely dangerous.
(There are reasons why Linux/Unix guys have been referring to 'dd'  as signifying "disk destroyer" or "delete data")

So unless you can guarantee for yourself that you will always know what you are doing and never be distracted even for a second, I'd suggest to not use 'dd' directly, but use one of the many program tools that were created which basically apply 'dd' in the low cloning level, but provide an interface to the user which helps avoid errors and misuse.

One such program is CloneZilla: http://clonezilla.org/

Another famous tool is MondoRescue ( http://www.mondorescue.org/ ). Basically a backup tool, it also works for restoring images to wiped drives with different disk geometry, so basically supports cloning to other systems as long as the specs are compatible:
http://www.mondorescue.org/docs/mondorescue-howto.html#AEN951

If you wish to test Clonezilla, I suggest to use the Parted Magic live CD: www.partedmagic.com
It also contains other Linux cloning tools, like G4L and partimage.
It can also be used for 'dd', 'ddrescue' and 'dd_rescue' which are best applied to unmounted disks.
0
 
madunixChief Information Security Officer Commented:
as said before you can use multiple tools to image/backup linux system  in my datacenter, i use mondo, it will do the job :

-http://amanda.zmanda.com/  amanda is a great backup solution, if you're willing to spend the time to learn how to set it up and so on.  It works very well, and there's good support from their mailing list.

-Backuppc is also a nice solution for backups for a nice how to(debian) but it should work on all linux as well check out http://www.debian-administration.org/articles/588
http://www.linux-magazine.com/w3/issue/105/060-061_kurt.pdf

-check bacula http://www.bacula.org
http://www.linux-magazine.com/w3/issue/57/Bacula_Backup_System.pdf

-http://clonezilla.org/
Free (GPL) Software.
Filesystem supported: ext2, ext3, ext4, reiserfs, xfs, jfs of GNU/Linux, FAT, NTFS of MS Windows, and HFS+ of Mac OS. Therefore you can clone GNU/Linux, MS windows and Intel-based Mac OS, no matter it's 32-bit (x86) or 64-bit (x86-64) OS. For these file systems, only used blocks in partition are saved and restored. For unsupported file system, sector-to-sector copy is done by dd in Clonezilla.
LVM2 (LVM version 1 is not) under GNU/Linux is supported.
Multicast is supported in Clonezilla SE, which is suitable for massively clone. You can also remotely use it to save or restore a bunch of computers if PXE and Wake-on-LAN are supported in your clients.

-mondo (imaging tools)
http://www.mondorescue.org/
Mondo is comprehensive. Mondo supports LVM 1/2, RAID, ext2, ext3, ext4, JFS, XFS, ReiserFS, VFAT, and can support additional filesystems easily: just e-mail the mailing list with your request. It supports software raid as well as most hardware raid controllers. It supports adjustments in disk geometry, including migration from non-RAID to RAID. Mondo runs on all major Linux distributions (RedHat, RHEL, SuSE, SLES, Mandriva, Debian, Gentoo) and is getting better all the time. You may even use it to backup non-Linux partitions, such as NTFS.
Mondo is free! It has been published under the GPL v2 (GNU Public License), partly to expose it to thousands of potential beta-testers but mostly as a contribution to the Linux community.


-netcat+tar
On the source server: (cd / && tar -cvf - ) | nc 192.168.1.2 2000
On the destination:: nc -l -p 2000 | tar -xvf -

-Linux Hot Copy (http://www.r1soft.com/tools/linux-hot-copy/)

-http://www-01.ibm.com/software/tivoli/products/storage-mgr/
We use it as backup enterprise solution with a  tape library for our environment (UNIX, AIX, Linux, Windows, Oracle, MSSQL...)

-Storix
soon am gonna get storix for my unix environment, storix system backup administrator (SBA) is a graphical interface for administration of various types of backups of AIX and Linux systems. Backup Administrator is available in different configurations, providing options for standalone system, and centrally network administered network backups. SBA was designed not only to backup data files to a network server, but to also provide the ability to reinstall a complete system from scratch while providing the flexibility needed to restore the backup onto a different hardware environment. SBA supports all major filesystems, Logical Volume Manger (LVM) and software RAID devices (meta-disks). http://www.storix.com/

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
md168Author Commented:
I tried DD, but it won't boot from the new drives.  

I will try clonezilla next.  

thanks!
0
 
torimarCommented:
I tried DD, but it won't boot from the new drives.

What went wrong?
I could think of two possible issues:

1. Grub errors
Unfortunately, Grub uses unique identifiers (UUID) to denominate partitions. On a new hard disk, these identifiers will change. So if your Grub refuses to boot and dumps you to the Grub prompt, you will have to manually boot the system and update Grub.

2. Problems with RAID
If encountering RAID problems, I'd suggest to test MondoRescue first (I linked to it above) because it supports both hardware and software RAID. Clonezilla, as far as I know, supports only hardware raid.
0
 
md168Author Commented:
I don't know why DD failed.  It wouldn't boot from the drives.  

Clonezilla is working.

thanks for the help everyone!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now