Solved

clone a linux drive

Posted on 2010-11-27
6
672 Views
Last Modified: 2012-08-13
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
Comment
Question by:md168
6 Comments
 
LVL 8

Assisted Solution

by:robthewolf
robthewolf earned 100 total points
Comment Utility
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
 
LVL 35

Assisted Solution

by:torimar
torimar earned 200 total points
Comment Utility
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
 
LVL 25

Accepted Solution

by:
madunix earned 200 total points
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:md168
Comment Utility
I tried DD, but it won't boot from the new drives.  

I will try clonezilla next.  

thanks!
0
 
LVL 35

Expert Comment

by:torimar
Comment Utility
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
 

Author Comment

by:md168
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now