LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices

By johnroberts at 2007-03-20 10:38
This how-to was originally sparked from my openSUSE, but it is probably applicable to any distro...
**************************************************************************************************** *****************************************

Problem: In a typical (or not-so-typical) openSUSE 10.1 64bit installation with XFS filesystem take a total backup of the system that can be used to perform a bare-metal-restore on a new (larger capacity than original) hard disk...
============================================================================
Difficult points:
a. ext2/ext3 is supported by popular commercial backup tools like NORTON GHOST but NOT XFS...(or other e-X-otic :-D filesystems)
b. the restore would use as a target, a larger capacity disk than the source and the procedure should be able to cope with this (if your hard disk fails it is highly unlikely that you will be able to find a disk of the exact same size, but since disks grow bigger and bigger it is plausible that you will be able to find a bigger one...)
c. bare-metal-restore from zero to working system and as simple as possible for n(.)(.)bs
============================================================================
Specifics:
I have tested the procedure I describe, going from an 80GB disk (system partition ~20GB (XFS) + user partition ~50GB (XFS) + swap) to a 320GB hard disk
The system described is Athlon64 based, on a NVidia NF4 based mobo with an NVidia graphics card (have NOT tested with other hardware and hence cannot guarantee that everything will go as smooth...)
The machine is supposed to have two different optical drives. The one I have has 1xCD-RW + 1xDVD-ROM
============================================================================
Needed material:
A. The new target disk
B. A Clonezilla LiveCD that you can download and burn from here: [http://clonezilla.sourceforge.net/]. I used version [clonezilla-live-20070205]
C. A GParted LiveCD that you can download and burn from here: [http://gparted.sourceforge.net/livecd.php]. I used version 0.3.4
D. The blank CDs needed above and one blank DVD-R
E. Some form of large capacity removable storage. I have used a common USB2.0 mounted 3.5" hard disk. It was purchased (not for this purpose alone...) as a common 3.5 hard disk, an external USB2.0 disk enclosure and it was partitioned and formatted in FAT32 for maximum cross-compatibility
F. The machine is supposed to have two different optical drives. The one I have has 1xCD-RW + 1xDVD-ROM
============================================================================
Steps:

Backup

1. Plug the USB2.0 disk in your system.
2. Use the Clonezilla LiveCD to boot your system. Once the initial GUI appears run with the default Clonezilla Live option (with frame buffer). Choose language and continue with the boot-up procedure until it finally reaches the command line prompt in text mode
3. Become root, issuing "sudo su -"
4. Having figured out how the two disks (the internal source disk to be backed-up and the external USB2.0 disk that will store the image for now...) are recognized (you can get a hint during the probing phase of the boot-up procedure...) you must mount the USB2.0 disk. To give an example, my source disk was /dev/hda and the USB2.0 disk partition can be /dev/hdb1 or maybe /dev/sdb1 (or 2, or 3....depending on the partition structure of the disk...). The mounting point MUST BE (BE VERY CAREFUL HERE) "/home/partimag". So, for example, if the image is to be stored in /dev/hdb1 you must issue "mount -t auto /dev/hdb1 /home/partimag".
5. Start the backup program by issuing "ocs-sr -x"
6. Choose language and "savedisk" to save the entire source disk (all partitions and disk info...)
7. VERY IMPORTANT!!! In the options that follow UNCHECK the one marked "-q Use ntfsclone to save NTFS partition instead of partimage". This option is enabled by default but is suitable only for NTFS filesystems!!!!
8. Choose compression type. I chose bzip2 that produces the smallest image. About 10GB in my system partition + 1.8GB in the user partition ended up fitting in a total of 4GB space (hence in a DVD-R)
9. Define the source disk when prompted, the image name and proceed to backup the source disk...
10. After completing the backup, the disk image that consists of various files in a single directory (that bears the name you chose...) was burned on a single DVD-R (you can use K3b, NERO or whatever...). If the image is bigger than the possible capacity of one DVD (say 8.5GB if you use DL media) you can use another application to span it across many optical disks for storage. BE AWARE THOUGH that (at least for the current version of Clonezilla...) IT IS NOT POSSIBLE TO RESTORE FROM SPANNED MEDIA!!! Hence if you DO span you must first rejoin the spanned pieces on - say - the USB2.0 external disk and then restore using the reverse procedure...
11. Backup is complete and the entire image is contained in one DVD-R...

Restore

1. According to the configuration described above (see F in needed material...), I will use the Clonezilla LiveCD to boot from the CD-RW. Proceed to boot your system. Once the initial GUI appears run with the default Clonezilla Live option (with frame buffer). Choose language and continue with the boot-up procedure until it finally reaches the command line prompt in text mode.
2. Become root, issuing "sudo su -"
3. Place the backup image DVD in the DVD-ROM and mount it by isssuing (...modify as needed by your configuration) "mount -t auto /dev/hdd /home/partimag". It is also possible to use - instead of the DVD - the USB2.0 hard disk (e.g. if the image cannot fit in one DVD...). In this case you can issue the command (as in the step 4 of backup above...) "mount -t auto /dev/hdb1 /home/partimag".
5. Start the backup program by issuing "ocs-sr -x"
6. Choose language and "restoredisk" to restore the entire source disk (all partitions and disk info...)
7. VERY IMPORTANT!!! In the options that follow UNCHECK the one marked "-g auto Client will reinstall grub in its HD MBR". This option is enabled by default and IT WILL SCREW-UP THE MBR, RENDERING THE RESTORED SYSTEM PARTITION UNBOOTABLE. DO NOT DISREGARD THIS, THINKING IT WOULD BE POSSIBLE TO REPAIR THE BOOTLOADER INSTALLATION FROM YAST!!!! IT WILL NOT WORK!!!! JUST UNCHECK IT!!!
8. Choose the image directory name (if properly mounted in step 3, the program will be able to "see" the image) and the target disk (possibly /dev/hda...) and proceed to restore
9. If all went well in step 8, after rebooting it will be possible to normally start openSUSE having a mirror of the partitions that resided in the original source disk. Now if the new target has different (bigger) size proceed to step...
10. Boot from the GParted LiveCD. If everything is OK in the partition editor window you will be able to see your partitions and a lot of unallocated space at the end of the drive. What needs to be done now is move/resize the partitions to reach the final needed setup. It is a very straightforward task through the GUI. I find it better to proceed in steps, so for me, step 1 was to move the user partition (in the partition editor the 3 partitions swap,system,user appeared contigious and in that order...) deep in the desired point of the unallocated space and check (by rebooting openSUSE...), step 2 was to grow (resize) the user partition to the end of the drive and check again and - finally - step 3 was to grow the system partition until all the unallocated space is used-up.

At this point - if everything has gone as planned - you have after rebooting, a ready working openSUSE system...

Most commercial packages support ReiserFS and ext2/ext3. The problem is that they do not support other file systems or that have only generic support through sector-by-sector copy that naturally produces HUGE images. Clonezilla was the first one to come across that supports nearly all major Linux file systems AND stores only data-occupied sectors (ergo small images...). If the Clonezilla team manages, in a future release, to include GParted or a similar easy-to-use tool and spanned media support, this will really be an excellent all-in-one backup/restore tool. But even with things as they are it is a lifesaver...

================================================================================
REVISION 1
===================================================
A couple more comments for all the friends interested in this:

1. I guess there are also other open-source tools out there with similar functionality. For example the SystemRescue LiveCD I think (not 100% sure) includes both GParted and Partimage. I have not checked them out, hence I don't know if they support all filesystems with minimal user intervention (without the user having to load manually special kernel modules to be exact...). I would welcome ANY feedback on similar processes yielding the same result...
2. I guess, if the image file size permits, it would be possible to have a GParted LiveDVD containing also the backup image. This way one could reduce the needed media to carry around to just two: Clonezila + GParted/Image. It is not possible though (with current version of Clonezilla) to have a Clonezilla/image disk because after boot-up the Clonezilla LiveCD is already mounted on a point different than "home/partimag". If I got it right there ARE some plans in the Clonezilla team to have this capability in the near future, i.e. the backup image to reside ON the Clonezilla LiveCD...
3. I was going through today the PartImage Wiki. It is not clear to me how to backup an entire disk (not just partition by partition...). If it is available, feedback on this is highly welcomed...
4. Unnecessary to stress that unlike GHOST, ACRONIS, etc, both GParted and Clonezilla are open-source tools...
5. When the time comes to update openSUSE to the next version, having an image at hand is a real confidence-builder...
6. Obviously above process applies for cloning many identical machines, without the GParted bit...
7. It can be considered as an asset the fact that the user does not have to install anything on the source disk

================================================================================
REVISION 2
===================================================

I found this polite note from Steven Shiau of the Clonezilla team in my mailbox today:

======================== QUOTE ===============================

Hi John:
About gparted and clonezilla, actually we made another live CD
recently,it's called DRBL live. This is the server edition for DRBL. It includes
all the DRBL functions and Clonezilla functions. Therefore you can use
that to replace Clonezilla live. The best thing is, gparted is also
included. Therefore you can use it to clone and resize partitions.
Now it's in the early beta status, if you have a chance, please have a
try.
For the short note, check this:
http://opensource.nchc.org.tw/drbl-live/te...l-live-note.txt
The programs are here:
http://opensource.nchc.org.tw/drbl-live/testing/
If you want to use gparted, you can not use drbl-live-standard one,
since it's only text mode. Use others.

Enjoy.

Regards,
Steven.

=================== UNQUOTE ===============================

It seems there is a good progress in merging the tools together. If I manage to scrounge
some time and test this I will post the results...


P.S.: This LiveCD - since it uses DRBL, Clonezilla's bigger brother - should be suitable for massive cloning as well...

Did a check on DRBL-Live with embedded GParted 0.3.3 and it works just fine!!! It seems this is now as good a solution as the {Clonezilla-LiveCD + GParted-LiveCD} pair. I did not take a fresh backup (...but I am guessing, that there would not be any problems with that...). I checked mounting of removable media (flash disks and external USB2.0 HDs...). The bare-metal-restore process I verified, breaking at a crisp 22' for the restore of my two 10.7GiB+1.8GiB XFS partitions + swap with an additional 44' for GParted to resize them to proper size (up to an hour with all the intermediate checks...). About 90' in total from nothing (like a dreaded disk loss) to full running system...(...or under 30' without resizing...)
My final comments to sum things up:
> This version of GParted seems to work much faster, so this is one more plus for this little tool.
> The root pass. is "drbllive" but GParted can be started anyway from the terminal by issuing "gksudo GParted"
> Other instructions are identical as per my original post...
> The XFCE version fits nicely on a little 8cm disk
> This is a GREAT base for a future full-blown rescue CD...

Greets



P.S. : News are coming at a very fast rate. Apparently it is so obvious how attractive the combination of these tools is, that there is a parallel integration approach from the GParted team this time: LarryT announced a combined Clonezilla - GParted LiveCD, where the user simply chooses through GRUB at boot-up which tool to load...This ISO is about 130MB in size...

by greybeard533 on Sun, 2007-04-29 21:53
A couple of newbie questions...

I've been trying to do a similiar thing using your how-to as a guide, but copying a partition not a whole disk.

I have a test box with 2 hard drives, one with an installation of libranet 3.0 (debian based distro) & the other with debian 4.0. I've been trying to copy the home partition from the libranet drive to the home partition of the debian drive. I installed debian using the guided partitioning, using the LVM option with a separate home partition. I haven't been able to get this done. When I enter "mount -t auto /dev/hda5 /home/partimag" to mount the target partition, I get the message that it's already mounted (because it's a logical volume, I think...?) so the newbie questions: Does clonezilla work with LVM ? Also, the libranet partition is reiserfs, & the debian is ext3, is this a problem ?...I may be trying to do something that's not supported. If it SHOULD work, I can post some details.

Thanks for any info...

greybeard...

by mejohnsn on Wed, 2009-11-04 18:14
The title of this thread is misleading: it is not about how to backup and restore the installation, it is about how to backup/restore the entire disk, including a lot more than just the installation.

Nor is it about just any 'backup' or any 'restore': it is about a backup (rsp. restore) of the ENTIRE system state. No coverage of differential or incremental backup, no option to restore just a part instead of the whole thing.


  



All times are GMT -5. The time now is 06:01 PM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration