LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-20-2015, 01:50 PM   #1
GATTACA
Member
 
Registered: Feb 2002
Location: USA
Distribution: Fedora, CENTOS
Posts: 209

Rep: Reputation: 32
Clonezilla image backup of multiple machines


Hi

I've got about 6 servers in our lab. All with different hardware and (unfortunately) with different version of linux on them for historical reasons.

I need a way to recover quickly each machine when/if the disk goes bad. My plan was to get a 1TB (or 2TB ?) external USB disk and put 2 partitions on it. On the first partition I will install Clonezilla. The second partition will hold the images for the various servers.

All of the servers have a similar disk layout:
PHP Code:
/dev/sda1*  /     ~100GB
/dev/sda2*  swap  4G
/dev/sda3*  /home ~200GB
/dev/sdb1  /data 4TB 

*/dev/sda is actually a logical volume on the newer systems.

I'm not worried about the data on /dev/sdb1. That's already under a managed backup system. My goal is to restore the machine back to life as quickly as possible.

My question is: is what I'm describing possible with Clonezilla? I've not used it for LVM's and I'm not sure it will work. Also, I'm not sure Clonezilla will be able to "see" the data partition on the external drive to mount it and access the image files.

Thanks in advance for any and all help.
 
Old 08-20-2015, 02:19 PM   #2
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
i would boot them up to a live-usb and do something like this:
Code:
# to make it compress better:
mkdir /hdmount
mount /dev/sda1 /hdmount
dd if=/dev/zero of=/hdmount/dummy
rm /hdmount/dummy
umount /dev/sda1
mount /dev/sda3 /hdmount
dd if=/dev/zero of=/hdmount/dummy
rm /hdmount/dummy
umount /dev/sda3

# do the actual dd:
dd if=/dev/sda bs=2048 | bzip2 > /external-bak/fc-20.iso.bz2           # to create the image
#bunzip2 -c /external-bak/fc-20.iso.bz2 | sudo dd of=/dev/sda bs=2048  # to restore the image
i think there is a way to mount image backups containing multiple partitions (kpartx ?)

like all things dd related. be triply sure you are backing-up/restoring the correct disk and partition.

Last edited by schneidz; 09-02-2015 at 09:35 AM.
 
Old 08-21-2015, 12:31 PM   #3
GATTACA
Member
 
Registered: Feb 2002
Location: USA
Distribution: Fedora, CENTOS
Posts: 209

Original Poster
Rep: Reputation: 32
Thanks for the quick reply and the example code.

I didn't know you could use dd to make an iso! That's good to know.

Can I ask why the initial dd if=/dev/zero of=/hdmount/dummy part?

Thanks
 
Old 08-21-2015, 12:35 PM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
since dd processes disks/partitions (and not individual files), if there is a lot of empty space that contains a lot of deleted files then there will be random 1's and 0's in the blank space. therefore compressing it using something like bzip2 will result in a larger archive.

over-writing the empty space with logical 0's will make the empty space compress to nearly nothing.

Last edited by schneidz; 08-21-2015 at 12:37 PM.
 
Old 08-21-2015, 08:16 PM   #5
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
Might be a choice for a fog backup solution.

Image and iso are not the same by the way.
 
Old 08-21-2015, 10:49 PM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
I find "dd" the absolute worst option for creating a backup. By design it is insensitive to the content of the disk - if there are filesystem error(s) they get propagated to the backup. Silently.

Clonezilla will be ok, but has some limitations (for me) re partition sizes. I would suggest you look at relax-and-recover. Seems to fit the bill nicely for you.
I keep meaning to test it but haven't yet, so I can't offer any direct recommendation.
 
Old 08-25-2015, 02:32 PM   #7
GATTACA
Member
 
Registered: Feb 2002
Location: USA
Distribution: Fedora, CENTOS
Posts: 209

Original Poster
Rep: Reputation: 32
Using Rear

Sorry for the long hiatus. I've been looking into the various suggestions made here.
Thank you all for your input. I appreciate all of it.

AT the moment, relax-and-recover (aka: rear) seems to be the top contender. It's pretty simple and I can put it on any of our systems.
However the software is proving challenging to use.

I decided try things out on an old workstation that as 160GB drive.
I'm backing up the entire disk to an external USB drive.
The system is running Centos 7.

My /etc/rear/local.conf is as follows:
Code:
OUTPUT=USB
BACKUP=NETFS
BACKUP_PROG=rsync
USB_DEVICE=/dev/disk/by-label/REAR-000
BACKUP_URL=usb:///dev/disk/by-label/REAR-000
Here are the commands I'm using (as root):
Code:
rear -v format /dev/sdb
rear -v mkbackup
And the process begins with this text:
Code:
Relax-and-Recover 1.17.1 / Git
Using log file: /var/log/rear/rear-bcell.log
Creating disk layout
Creating root filesystem layout
TIP: To login as root via ssh you need to set up /root/.ssh/authorized_keys or SSH_ROOT_PASSWORD in your configuration file
Copying files and directories
Copying binaries and libraries
Copying kernel modules
Creating initramfs
Copying resulting files to usb location
Encrypting disabled
Creating rsync archive '/tmp/rear.KbV2DiijgZeiQqk/outputfs/rear/bcell/20150825.1455/backup'
Preparing archive operation sending incremental file list
Lots of file names fly by in the terminal for a while....

When this is done I shut down the workstation, unplug the primary hard drive, and connect a different disk of the same size.
This second drive has been zero'd out prior to this use so it's good to go for testing purposes.

I'm able to boot to the USB disk. However there are no images to use listed for the computer I'm recovering.
Did I miss a step?

Thanks
 
Old 08-25-2015, 04:52 PM   #8
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Check the log it produces, but looking at the quick-start, you haven't built the bootable image after the format. Do a "mkrescue" before the "mkbackup" (or since it's a test, just copy the backup from /tmp to the external - all good experience with a new tool).
 
Old 08-28-2015, 09:06 AM   #9
GATTACA
Member
 
Registered: Feb 2002
Location: USA
Distribution: Fedora, CENTOS
Posts: 209

Original Poster
Rep: Reputation: 32
Hi

Just wanted give an update on this post (for any interested parties).
syg00's suggestion got me through making the working instance of rear (complete with a backup).
Unfortunately the restore part doesn't seem to work. rear gets as far as formatting the hard drive of the new disk and then it complains that it can't install grub(??).

So I'm going to look into the other suggestions made here.

Cheers
 
  


Reply

Tags
clone image



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
quick backup and restore Ubuntu to multiple machines Droa Linux - General 1 09-26-2012 06:04 AM
need method to image custom Linux distro and distribute to multiple machines khatrianand Linux - Newbie 6 11-23-2011 05:26 PM
Unable to restore a backup image to drive using Clonezilla justmehere Linux - Software 8 04-25-2011 01:05 AM
clonezilla clone disk to image, when restore from image to destination hdd problem. hocheetiong Linux - Newbie 3 05-06-2008 07:59 PM
running a single image on multiple machines subzero_ice Linux - General 0 05-11-2004 07:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:33 AM.

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
Open Source Consulting | Domain Registration