LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 08-11-2017, 05:20 AM   #1
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Rep: Reputation: 19
Question 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.
 
Old 08-11-2017, 06:15 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by penyuan View Post
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
 
1 members found this post helpful.
Old 08-11-2017, 07:04 AM   #3
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Original Poster
Rep: Reputation: 19
Thumbs up

Quote:
Originally Posted by TenTenths View Post
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...
 
Old 08-11-2017, 07:26 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
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.
 
1 members found this post helpful.
Old 08-11-2017, 07:28 AM   #5
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Original Poster
Rep: Reputation: 19
Thumbs up

Quote:
Originally Posted by TenTenths View Post
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!
 
Old 08-11-2017, 07:29 AM   #6
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
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.
 
1 members found this post helpful.
Old 08-11-2017, 08:02 AM   #7
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Original Poster
Rep: Reputation: 19
Question

Quote:
Originally Posted by IsaacKuo View Post
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
 
Old 08-11-2017, 08:30 AM   #8
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
Quote:
Originally Posted by penyuan View Post
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.
 
1 members found this post helpful.
Old 08-11-2017, 03:03 PM   #9
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
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.
 
1 members found this post helpful.
Old 08-11-2017, 03:12 PM   #10
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Original Poster
Rep: Reputation: 19
Question

Quote:
Originally Posted by tofino_surfer View Post
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!!
 
Old 08-11-2017, 09:55 PM   #11
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
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.

http://blog.endpoint.com/2015/01/shr...-possible.html

Last edited by tofino_surfer; 08-11-2017 at 10:15 PM.
 
1 members found this post helpful.
Old 08-13-2017, 08:00 PM   #12
penyuan
Member
 
Registered: Oct 2009
Distribution: Scientific Linux 6
Posts: 190

Original Poster
Rep: Reputation: 19
Smile

Quote:
Originally Posted by tofino_surfer View Post
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.

http://blog.endpoint.com/2015/01/shr...-possible.html
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.
 
  


Reply

Tags
cloning, hdd, ssd



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cloning SSD vs HDD with DD replica9000 Linux - Software 13 12-16-2016 08:08 PM
Install Linux in Toshiba u940 series with 32gb ssd and 750gb hdd I would like to have boot code in ssd only cvkchary Linux - Laptop and Netbook 4 08-31-2016 04:26 PM
Cloning HDD install to SSD Condemn Slackware 1 02-14-2014 07:58 AM
[SOLVED] SSD cloning quick question lpallard Linux - Hardware 13 02-22-2011 06:22 PM
cloning mixed Linux - Win xp on new SSD for laptop trentfox Linux - Hardware 3 02-09-2010 07:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 07:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration