[mythtv-users] MythTV BackEnd system HDD to smaller SSD Ubuntu
Simon Hobson
linux at thehobsons.co.uk
Thu Dec 24 08:18:24 UTC 2015
Mike's JdJ <stepsisters at comcast.net> wrote:
> 1. Is there a drive clone tool that will intelligently copy my mostly-empty HDD to the smaller SSD?
Not a drive clone tool as such, but in the true Unix philosophy a number of tools each of which does one part of it and does it well !
The way I do it is :
(note: I've used $src and $dst, you need to replace these with the real device names - eg /dev/sda)
Boot from a live CD - there is (IMO) some advantage in it being similar to the running system but I don't think it's critical. It is possible to do this running the system itself, but it needs a little more care and a few tweaks - it's safer & easier to boot off a live CD.
Partition the destination drive - fdisk, parted, whichever is your preferred tool. If using GPT (which isn't needed, MBR is fine for that size of disk) then include a small bootloader partition.
Make the filesystem(s) on the destination :
mkfs -t <your choice of filesystem> -o <options> $dst1
(repeat for $dst2, $dst3, etc as required)
And don't forget to make swap space on the new swap partition :
mkswap $dstn
Make two mountpoints :
mkdir /src /dst
Mount your source and destination disks :
mount $src1 /src
mount $dst1 /dst
If you have more than one filesystem, you'll need to create additional directories and mount them, eg :
mkdir /dst/var /dst/home
mount $src2 /src/home
mount $src3 /src/var
mount $dst2 /dst/home
mount $dst3 /dst/var
Note: if you want to, you can change the filesystem layout here. For example, you could choose to go with less filesystems (eg no have a /home/, or make more. Just make sure that whatever layout of mountpoints you have for source and destination matches what you have now and what you want.
You might choose to keep some parts of the system on HD - it depends on space etc. In that case, you need to do a little more work in excluding stuff you copy to SSD.
You are now ready to copy the files (note: the trailing slashes in source and destination are important !) :
rsync -avH /src/ /dst/
You now have a complete copy of your system.
Now you have to install your bootloader.
This is more or less cribbed from a forum related to some small "appliance" boards, but it's generally applicable. The first bits mount stuff that grub needs to work properly, and then you can just install it :
mount --bind /dev /dst/dev
mount --bind /sys /dst/sys
mount --bind /proc /dst/proc
mount --bind /run /dst/run (recommended if you are using systemd)
chroot /dst
grub-install /dev/your-grub-boot-device
Adjust /etc/fstab on your copy. Adjust anything else you've changed. Shutdowen, disconnect the old drive and boot up - it *should* just boot off the new one.
When it doesn't, you kick yourself, reboot off the live CD, run the partition editor and mark your boot partition (whether that's a separate /boot or just part of /) active, and reboot !
More information about the mythtv-users
mailing list