View previous topic :: View next topic |
Author |
Message |
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Sat Feb 22, 2014 6:18 pm Post subject: Snapshots |
|
|
I'd like to make a snapshot of my laptop so I can clone it onto another identical laptop. Which tools should I use for this? |
|
Back to top |
|
|
mrbassie l33t
Joined: 31 May 2013 Posts: 781 Location: over here
|
Posted: Sat Feb 22, 2014 6:40 pm Post subject: |
|
|
Try clonezilla. |
|
Back to top |
|
|
vaxbrat l33t
Joined: 05 Oct 2005 Posts: 731 Location: DC Burbs
|
Posted: Sat Feb 22, 2014 6:57 pm Post subject: imaging drives |
|
|
Make sure that the destination drive is the same size or larger than the source. Pick up a usb to SATA converter if you don't already have one. I've seen some of these included with "upgrade" kits for the bigger replacement drives which are basically just a cable with a standard sata hot swap bracket sata and sata power connector socket on the end. Others have a usb on one end and a cradle with various drive size slots on the other end.
Plug and boot from a thumb drive or dvd with a live distro installed on it. Plug in the converter to a usb port. You may have to find the "powered" one if your sata converter doesn't have a wall wart for power.
Your live distro boot will probably populate /dev/disk/by-id properly with the drives that show up. Check the make and serial numbers on the drives to make sure that you get your drive letters correct for dd with:
Code: | ls -l /dev/disk/by-id |
Then clone from the old drive (if=) to the new drive (of=) as follows:
Code: | dd if=/dev/sd<letter> of=/dev/sd<letter> bs=2048 |
Depending on drive types and sizes, this can take anywhere from about 15mins to a couple of hours, but it will copy everything including the boot record and partitioning information.
You will need to fix your network setup if you have edited your /etc/conf.d/net file for anything other than a simple dhcp configuration. You may also want to look for and edit /etc/udev/rules.d/70-persistent-net.rules to edit the MAC address(es) if you want to keep your network device names consistent. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21708
|
Posted: Sat Feb 22, 2014 8:01 pm Post subject: |
|
|
Beware that the advice from vaxbrat copies everything, including free space. If the destination drive is solid state, you should not do this. Instead, you should copy the files via tar or rsync -a.
If you have a substantial amount of free space on the source filesystem, it would be faster to copy the files instead of the drive. |
|
Back to top |
|
|
grant123 Veteran
Joined: 23 Mar 2005 Posts: 1080
|
Posted: Sun Feb 23, 2014 2:48 pm Post subject: |
|
|
Here's what I have so far. On the target laptop I boot sysresccd from a USB stick and run this script:
Code: | #!/bin/bash
fdisk /dev/sda <<EOF
d
1
d
n
p
1
2048
+64M
a
1
n
p
2
133120
250069679
w
EOF
umount /dev/sda1
umount /dev/sda2
mkfs.ext2 /dev/sda1
mkfs.ext4 /dev/sda2
mount /dev/sda2 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
echo "config_enp0s20u1=\"192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255\"" > /etc/conf.d/net
/etc/init.d/NetworkManager restart
rc |
Then on the source laptop I run:
Code: | # mount /dev/sda1 /boot
# rsync -av -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --include=/dev/console --include=/dev/null --exclude=/swapfile --exclude=/home/* --exclude=/media/* --exclude=/proc/* --exclude=/root/* --exclude=/sys --exclude=/usr/portage --exclude=/usr/src/* --exclude=/var/cache --exclude=/var/log --exclude=/var/tmp/* --exclude=/dev/* --exclude=/mnt/* --exclude=/tmp --exclude=/var/spool/* /* 192.168.1.2:/mnt/gentoo
# umount /dev/sda1 |
Then on the target laptop I run:
Code: | # grub-install --no-floppy --root-directory=/mnt/gentoo /dev/sda |
That produces a working system on the target. Lots more to do.... |
|
Back to top |
|
|
|