Make sure you have installation media for the architecture you're using. I used an 8GB usb stick drive with the 64bit version of Mint 17.3 cinnamon. My situation was simple enough. sda1 is 200GB and was empty, and sda2 is 100GB and Mint was installed there. The source and destination can be different disks (or even on different computers on a network, but I haven't used that feature). The destination should be bigger (certainly not smaller of course) than the source.
If you're planning to remove the original HDD after copying it, you'll need to make sure the new drive has a swap partition and change its entry in fstab accordingly. More on that later.
Boot and run Mint on the Live media. Open the file manager and click on the two partitions you want to copy from and to. Then it's mostly command line from there, so open a terminal. I usually use 'df -h' to see what's mounted. It shows the sizes, which helps ensure I get FROM and TO right in the next steps.
The text in quote boxes below is pasted from a VirtualBox VM where I created a new drive with the intention of copying everything on the working installed (Mint 17.3) OS to it and booting it. I understand it's a pointless exercise in a VM, but it's useful for the tutorial.
So there you can see the two partitions. /dev/sda1 has 6.9GB used and /dev/sdb1 is virtually empty. You'll need the long UUID number of the destination partition later, if the intention is to boot the copy.mint@mint ~ $ df -h
Filesystem Size Used Avail Use% Mounted on
/cow 1001M 35M 966M 4% /
udev 990M 4.0K 990M 1% /dev
tmpfs 201M 1.1M 200M 1% /run
/dev/sr0 1.5G 1.5G 0 100% /cdrom
/dev/loop0 1.5G 1.5G 0 100% /rofs
none 4.0K 0 4.0K 0% /sys/fs/cgroup
tmpfs 1001M 8.0K 1001M 1% /tmp
none 5.0M 0 5.0M 0% /run/lock
none 1001M 996K 1000M 1% /run/shm
none 100M 16K 100M 1% /run/user
/dev/sda1 18G 6.9G 11G 41% /media/mint/1e5eef50-3996-4e27-b0f4-e13166eb08c3
/dev/sdb1 20G 44M 19G 1% /media/mint/da1dfd8e-362d-4b2e-bd18-3edaa754c396
Make partitions/folders to use as the mount points:
Next un-mount the two partitions (either with 'umount' or in the file manager)mint@mint ~ $ sudo mkdir /media/FROM
mint@mint ~ $ sudo mkdir /media/TO
I'm copying from sda1 to sdb1 for the example so to mount them at the new points:mint@mint ~ $ sudo umount /dev/sda1
mint@mint ~ $ sudo umount /dev/sdb1
Then to create the copy I used:mint@mint ~ $ sudo mount /dev/sda1 /media/FROM
mint@mint ~ $ sudo mount /dev/sdb1 /media/TO
The -aA part is essential. The small a is for 'archive' and it does the same as '-rlptgoD' which is recursive, copies links, preserves permissions, modification times, groups, owners and device and special files. The big A is for ACLs to be copied as well. I don't think Mint uses many of those, but the Nemo file manager couldn't mount drives when I tried without that.mint@mint ~ $ sudo rsync -avA --progress /media/FROM/ /media/TO
The -v and --progress are to make the process a bit more interesting. You can see the amazing speeds the file system can do while large files are copying.
The last few lines of the output are shown below:
and the last two lines of the output of 'df' now look like:var/spool/samba/
var/tmp/
var/tmp/kdecache-john/
var/tmp/kdecache-john/icon-cache.kcache
10,547,304 100% 28.74MB/s 0:00:00 (xfr#163754, to-chk=2/219026)
var/tmp/kdecache-john/ksycoca4
973,200 100% 2.45MB/s 0:00:00 (xfr#163755, to-chk=1/219026)
var/tmp/kdecache-john/ksycoca4stamp
518 100% 1.33kB/s 0:00:00 (xfr#163756, to-chk=0/219026)
sent 6,882,106,634 bytes received 3,328,593 bytes 49,714,333.77 bytes/sec
total size is 6,867,749,195 speedup is 1.00
mint@mint ~ $
---------------------------------------------------------------------------------------/dev/sda1 18G 6.9G 11G 41% /media/FROM
/dev/sdb1 20G 6.9G 12G 38% /media/TO
So that's the copying done. If you want to use the copy next boot, there's a little more to be done.
So while still in the Live environment - first run inxi:
Carefully edit the copied /etc/fstab to make the line for the root of the file system include the uuid (in my case) of the copied partition (or the 'label' if you're using them). I use 'nano', but use the editor you prefer. Don't be tempted to leave blank lines, as it will reject those iirc:mint@mint ~ $ inxi -pou
Partition: ID-1: / size: 1001M used: 35M (4%) fs: overlay dev: /dev/cow uuid: N/A
ID-2: /media/FROM size: 18G used: 6.9G (41%) fs: ext4 dev: /dev/sda1
uuid: 1e5eef50-3996-4e27-b0f4-e13166eb08c3
ID-3: /media/TO size: 20G used: 6.9G (38%) fs: ext4 dev: /dev/sdb1
uuid: da1dfd8e-362d-4b2e-bd18-3edaa754c396
ID-4: swap-1 size: 2.15GB used: 0.00GB (0%) fs: swap dev: /dev/sda5
uuid: 2536e8a0-8b87-4a70-ae71-dc1b39e4cafe
Unmounted: No unmounted partitions detected
Before:mint@mint ~ $ sudo nano /media/TO/etc/fstab
Code: Select all
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=1e5eef50-3996-4e27-b0f4-e13166eb08c3 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=2536e8a0-8b87-4a70-ae71-dc1b39e4cafe none swap sw 0 0
Code: Select all
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sda1 during installation
UUID=da1dfd8e-362d-4b2e-bd18-3edaa754c396 / ext4 errors=remount-ro 0 1
# swap was on /dev/sda5 during installation
UUID=2536e8a0-8b87-4a70-ae71-dc1b39e4cafe none swap sw 0 0
Now all that remains is to 'chroot' to the copy and make Grub configure itself.
Unmount the TO partition and mount it at /mnt
Then mount all the device files etc.mint@mint ~ $ sudo umount /dev/sdb1
mint@mint ~ $ sudo mount /dev/sdb1 /mnt
Then go there:mint@mint ~ $ for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
The "mint" should change to red, then update-initramfs:mint@mint ~ $ sudo chroot /mnt
(The warning can be ignored, or may not be seen.)mint / # update-initramfs -u
update-initramfs: Generating /boot/initrd.img-3.19.0-32-generic
Warning: No support for locale: en_GB.utf8
mint / #
Then all that remains is to configure the Grub boot loader:
Finally update Grub:mint / # grub-install --recheck /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.
Exit from chroot and from the terminal window and reboot:mint / # update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.19.0-32-generic
Found initrd image: /boot/initrd.img-3.19.0-32-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
No volume groups found
Found Linux Mint 17.3 Rosa (17.3) on /dev/sda1
done
As a variation on the above - you can just use it as a way of keeping a backup copy. The rsync manual explains that "It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination." which makes it fast to keep up to date...mint / # exit
mint@mint ~ $
Hoping I haven't missed any steps, or included any unnecessary ones, but please let me know if you encounter any problems.
Many thanks to austin.texas for the post with the original idea. Rsync is a really useful tool...