[SOLVED] Tips/warnings for cloning OS disk from HDD to SSD?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Tips/warnings for cloning OS disk from HDD to SSD?
I've got an fully updated RHEL 7.4 set up on a traditional HDD on one of my machines. Recently an equally sized SSD became available, and I'd like to swap the HDD for the SSD and clone my OS onto it to enjoy better performance.
I'm planning to use a Clonezilla live USB to clone everything from the HDD to the SSD, and plug the SSD back into where the HDD was.
But I've never done this before, so (1) is this the way to do it? and (2) once the cloning is done can I expect to just boot into right where I left off on the HDD or are there settings I should change? Thank you.
But I've never done this before, so (1) is this the way to do it? and (2) once the cloning is done can I expect to just boot into right where I left off on the HDD or are there settings I should change? Thank you.
Assuming your SSD is the same connection then it shouldn't be a problem. I've used Clonezilla before to do things such as move from P2V and for backing up / restoring to the same metal after things like hardware RAID changes, so you shouldn't have any problems. Of course you have the luxury of being able to just stuff the old spinner back in if your new SSD doesn't boot (although it should!)
Last edited by TenTenths; 08-11-2017 at 07:23 AM.
Reason: Forgot to close the quote tag
Assuming your SSD is the same connection then it shouldn't be a problem... so you shouldn't have any problems. Of course you have the luxury of being able to just stuff the old spinner back in if your new SSD doesn't boot (although it should!)
Excellent, I'll give it a shot, then!! Thank you very much!!
BTW, will my OS automatically "understand" that it is now in a SSD and handle it appropriately???? I vaguely recall (and maybe it's Windows rather than GNU/Linux) that you need to let the OS "know" that it is dealing with a SSD...
There'a a bunch of wisdom around changing things in fstab around mitigating write "wear" Google will (as usual!) turn up a whole bunch of often conflicting opinions.
There'a a bunch of wisdom around changing things in fstab around mitigating write "wear" Google will (as usual!) turn up a whole bunch of often conflicting opinions.
OK. But sounds like it'll be OK if I simply use the defaults.
Thanks @TenTenths!
If the SSD isn't quite as big, you'll need to shrink the last partition a bit to make sure it all fits. Use "fdisk -l" to list the drives and see precisely how big they are.
If the SSD isn't quite as big, you'll need to shrink the last partition a bit to make sure it all fits. Use "fdisk -l" to list the drives and see precisely how big they are.
Uh oh! How do I even shrink a partition before cloning? I've only used gparted, can it be done there? BTW the filesystem on my current HDD is XFS in a LVM...
Last edited by penyuan; 08-11-2017 at 08:02 AM.
Reason: Added LVM
Uh oh! How do I even shrink a partition before cloning? I've only used gparted, can it be done there? BTW the filesystem on my current HDD is XFS in a LVM...
Normally, I'd say yes - use gparted. But I was assuming a more traditional set up of partitions. Looking up LVM, it seems there's a nice GUI tool for it (the equivalent of gparted):
system-config-lvm
I can't offer detailed advice on how to use it, since I haven't done it myself. Hopefully, it's already included in the Clonezilla LiveCD/USB you are intending to use.
In any case, if the results of "fdisk -l" reveal that the SSD is the same size or larger than the hard drive you're cloning from, then just don't worry about it.
Uh oh! How do I even shrink a partition before cloning? I've only used gparted, can it be done there? BTW the filesystem on my current HDD is XFS in a LVM...
This changes everything. XFS file systems can't be reduced in size. You must copy the data to another device, reformat the partition, create a smaller XFS file system, an then restore your data.
Also you can't use gparted with LVM partitions. You would need to use LVM commands.
Quote:
Looking up LVM, it seems there's a nice GUI tool for it (the equivalent of gparted):
system-config-lvm
This information is several years out of date. This "nice gui" was deprecated several years ago because it was dangerous to use. It was removed in Fedora 19 and is not available in RHEL/Centos 7. The GNOME Disks GUI has some LVM functionality but can't do everything the LVM commands can.
Considering that XFS can't be shrunk and the use of LVM I don't recommend shrinking your old disk at all.
If your SSD is smaller than your old HDD then forget about using Clonezilla. You can create new smaller LVM volumes on the SSD using LVM commands and then use rsync with the various volumes to copy the data. This is much safer than trying to shrink XFS on LVM which risks your data.
Since the new file systems will have new UUIDs and the new LVM VG will have a new name you will have to edit the fstab and grub.cfg to use the new IDs and generate a new initrd with dracut to make the SSD bootable.
This changes everything. XFS file systems can't be reduced in size. You must copy the data to another device, reformat the partition, create a smaller XFS file system, an then restore your data.
...
Considering that XFS can't be shrunk and the use of LVM I don't recommend shrinking your old disk at all.
If your SSD is smaller than your old HDD then forget about using Clonezilla. You can create new smaller LVM volumes on the SSD using LVM commands and then use rsync with the various volumes to copy the data. This is much safer than trying to shrink XFS on LVM which risks your data.
Since the new file systems will have new UUIDs and the new LVM VG will have a new name you will have to edit the fstab and grub.cfg to use the new IDs and generate a new initrd with dracut to make the SSD bootable.
Oh man, I have zero experience with editing fstab, grub, initrd, and dracut all at the same time (I've only worked with fstab and a tiny bit of initrd...). Now I wonder if I should just re-install the OS and restore my home folder (my home folder is already regularly backed up) and go from there?
Thank you so much for this important information, I was almost going to try Clonezilla!!
I found this very useful blog post about someone migrating an XFS on LVM system using xfsdump and xfsrestore instead of rsync. At the end if you rename the new volume group to that of the old ( after you have deleted or renamed the original vg ) then you don't have to edit fstab, grub or generate a new intird at least for the root and swao oartitions. References to /boot partition may require some edits.
There are a few typos and errors but this is is very similar to what you are doing except this article concerns VMs.
I found this very useful blog post about someone migrating an XFS on LVM system using xfsdump and xfsrestore instead of rsync. At the end if you rename the new volume group to that of the old ( after you have deleted or renamed the original vg ) then you don't have to edit fstab, grub or generate a new intird at least for the root and swao oartitions. References to /boot partition may require some edits.
There are a few typos and errors but this is is very similar to what you are doing except this article concerns VMs.
Hey thanks for this!! Maybe I'll make a good backup of my current system, try the things in the post you linked to, and in case I screw up I'll just re-install the OS onto the SSD and restore the backup.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.