Kind-of like this question but slightly different (I think), in that I have 6 identical Acer Aspire Revo R3610 machines. One is (almost) configured to my requirements - when I'm done preparing it I'd like to make the other 5 machines absolutely the same. I'm very new to Ubuntu, what's the most straightforward (easiest) way of doing this?
The machines are going to live on different networks if that might otherwise be a problem (eg with Windows you can clone disks but you then have to make registry changes afterwards if they're going to run on the same network etc). The hardware in all 6 machines is, I stress, the same!
How can I efficiently clone one source image on to these identical machines?
Please restrict one software/solution per answer
Clonezilla sounds like it fits your needs
dd
A low level copy using dd would do the trick!
Watch out for conflicting IP addresses and hostnames.
Basically put the source drive and destination drive in the same machine, boot into a live cd. And run something like the following where
/dev/sda
is the source and/dev/sdb
is the destination:dd if=/dev/sda of=/dev/sdb bs=4096
I remember the operands by:
if
-> input fileof
-> output filebs
-> block size (how many bytes to read at a time)The easiest way to do this is to run a bare bones Ubuntu installation on your hard drive, install VirtualBox and set up a virtual Ubuntu machine. Run your virtual machine and set up that installation just like you want it with all the bells and whistles you want. Do all of your working and playing on the virtual computer.
VirtualBox maintains the virtual machine as a large disk image file (.vdi) along with a few other much smaller configuration files. Whenever you want to backup your virtual machine, just shut it down and copy its directory to your backup location. I use a Passport external drive for this purpose.
Right now, there is both a Windows 7 and an Ubuntu 12 virtual machine on that external drive. All of the system updates, programs, personal files, pictures, whatever, get saved in those virtual machines. A backup of this type is very fast, as one big disk image file will transfer much quicker than a bunch of individual files would. Since VirtualBox maintains the files in that format all the time, the virtual machine is always configured to be backed up.
One advantage of that setup is that I can run those virtual machines off the external drive on any computer with VirtualBox installed, so now, instead of lugging my computer all around, I just bring my external drive with both Windows and Ubuntu, install VirtualBox on whatever computer I plan to use (I have all the VirtualBox installation files also on my external hd - they are available for all the main operating systems), and I am ready to go. I can either copy my virtual machine to the computer I am using, or just run it off of the external drive.
If your computer crashes and dies at some point, who cares, you just grab your Ubuntu installation disk, install it on your new or repaired computer, hook up your external drive, install VirtualBox, and copy your virtual machines back on to your computer - problem solved with minimal stress, loss of time, and loss of data. How much data you lose depends on when you last backed up. For myself, I do a new backup whenever I make a major change or add a hard to get program. Just make sure that your virtual machine is operating normally when you do it. You would not want to copy a corrupted machine over a good one.
And no, I don't work for VirtualBox.
Create an image using Remastersys, transfer it to a pen drive using the Startup Disk Creator utility and install on other system.
Partimage
Another great cloning utility which I've used, as well. Features a terminal gui.
I would get one computer all the way you want it, and install the openssh-server package. Generate a ssh key pair with
ssh-keygen -t rsa
. Add the public key to /root/.ssh/authorized_keys2. Then I would boot the new computers with a live cd and plug in a usb stick with the ssh private key. Use gparted to create a new partition. Then mount the new partition and run something likesudo rsync -avzx -e "ssh -i /media/disk/path/to/privatekey" --exclude=".gvfs" root@<ImageComputerIP>:/ /path/to/new/partition/
Use the
blkid
command to find the UUID of the filesystem you just created. Edit the/path/to/new/partition/etc/fstab
to reflect the new UUID (and filesystem type if you used a different filesystem.)Then I would follow the instructions on https://help.ubuntu.com/community/Grub2/Installing#via_ChRoot about how to install from a chroot.
A simplified version of that page (which doesn't account for lvm, software raid, or bcache, or separate /boot like the wiki page does):
By the way, this works good for backup, too. Ubuntu, unlike Windows, doesn't seem to have problems being transplanted to different hardware. I've put hard disks from one computer in another and it did fine, and I've copied installs to different hardware and it did fine.
I use
ddrescue
for exactly this task. It works flawlessly. Super simple.See this thread on technibble for details
G4L
Ghost for Linux
Ghost for Linux is a hard disk and partition imaging and cloning tool similar to Norton Ghost(c) and (tm) by Symantec. The created images are optionally compressed, and they can be stored on a local hard drive or transferred to an anonymous FTP server. A drive can be cloned using the Click'n'Clone function. g4l supports file splitting if the local filesystem does not support writing files >2GB. The included kernel supports ATA, serial-ATA, and SCSI drives. Common network cards are supported. It is packaged as a bootable CD image with an ncurses GUI for easy use.
Fsarchiver
I don't know why no one mentioned this. This is especially handy when you want to restore the partition's content on another file system type (for example, restoring ext4 content to ext2 or reiserfs) or you want to restore to an smaller partition.
I used it and it's very easy. For example, to clone a partition say
/dev/sda1
you use a command like thisThe
-A
option allows you to copy partition even if it is used! Great feature!-j 2
says to use 2 CPU core for compression. Useful for multi-cored CPU and if you use compression-z 1
sets the compression level.To restore the file system you used
The
id=0
says you're restoring the first filesystem from the archive (Even if you don't saved multiple partitions on a single archive, you need to specify it). Anddest=/dev/sda2
sets the destination of the restoring.I do this a lot, using rsync.
First you can run rsync to load all the data to an external hard drive (your external hard drive should be in ext4 - I use this, so I know it works): I assume you have two partitions: /dev/sda1 (root) and /dev/sda2 (swap).
Run in your original computer:
After copying the data, boot your next computer with an usb stick, and format the internal hard drive as the original hard drive.
Mount your external drive to
/mnt
, and copy the UUIDs of all partitions. Edit the UUIDs of the partitions of the new computer and put the same UUIDs you have copyied from the original data (it is in/mnt/etc/fstab
).Shut down the swap:
Create a new swap using the original UUID, copyied from
/mnt/etc/fstab
:(I supose your swap is in
/dev/sda2
)Next, change the UUID of
/dev/sda1
: (the partition should be unmounted in order to change UUIDs)Done this, mount the destination partition:
Reverse rsync to the destination:
Reinstall the grub:
This will work. Remember to edit
/etc/hostname
and/etc/hosts
to change the hostname for each machine in order to avoid network conflicts.