I am running CentOS 7 on a HDD disk drive.

For some reasons, I want move the OS image on HDD to a new SSD.

(Using SSD as data storage is not an option, for some reasons)

How can I copy the existing installed CentOS 7 image without loss to a new SSD drive?

It seems that someone uses dd command to copy the device data, but I guess there must be better and reliable way to achieve it.

How can I do this?

// SSD size is bigger than HDD's.

I have 25 machines to work on. If I can do copying the OS image on commands, it would be way better


I suppose that SSD is not the same size? Personally I would connect SSD as a secondary drive, make a partitioning scheme and use rsync to copy data. To make a process easier I would use live CD of my distribution to "freeze" any changes source on disk. This requires to install boot loader on new disk if applicable.


dd is the most reliable way IMO, since it makes a duplicate of your HDD to the SSD. Although you have to keep in mind that the SSD must be in equal or greater size, since the dd command will duplicate every block on your HDD to the SSD. So it has to fit.

Better is to reinstall the OS on the SSD and transfer your own data with rsync or so.


If you want to make a bitwise copy, you should use another machine.

Remove the HDD from the original machine, and connect both HDD and SSD to another Linux machine via SATA cable. Then boot this machine and ensure it recognizes both drives. Copy the content of the HDD (let's assume is /dev/sdb) over the SSD (/dev/sdc):

cat /dev/sdb > /dev/sdc  

Yes, you can safely use cat instead of dd. Not only cat is perfectly able to handle binary streams (at least in all modern Linux distros), but it'll also choose the optimized blocksize for the copy, so the copy will be faster. In terms of reliability, it's as reliable as dd.

Once the copy is finished, you can install the SSD on the original machine and it'll work immediately.

Note that since you said the size of the SSD is bigger, there will be a blank space at the end of the disk -- you should then use a partitioning tool to create a partition in it to avoid wasting disk space. However, if you don't do this, nothing bad will happen.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.