Kitz Forum

Computer Software => Linux => Topic started by: sevenlayermuddle on February 05, 2017, 11:27:55 AM

Title: Copy system disk using dd
Post by: sevenlayermuddle on February 05, 2017, 11:27:55 AM
I am contemplating replacing the system disk in my CentOS server.   The disk is perfectly healthy and a good quality 'Enterprise' grade but has loud clicks and thuds that accompany each head movement, that are driving me nuts.   I gather such noise is sometimes the case with 'Enterprise' disks as the noise is not a problem in a commercial server room.

So... It is a 2TB disk.   I'm assuming I can just boot up from cd, then dd the unmounted old disk to a new one, as long as the new is at least as big?   It'll take a while, I know, but is it a good way to go?   There's a couple of things I am unsure about, which is embarassing as there was a time I should have known these things... :-[

1- My /etc/fstab entries are specified by uuid.  Will a copy using dd propagate the old disk's partition uuids to the new one?

2 - If the new disk is actually bigger than the old, can I simply modify the partitioning afterwards, to pick up the extra space, probably as an additional partition?

Grateful for any comments.


Title: Re: Copy system disk using dd
Post by: broadstairs on February 05, 2017, 11:38:53 AM
Not tried it but I think it will copy the UUID from what I've read which will cause issues so you would need to change the UUID after the copy on the new disk prior to booting the system, unless you physically remove the old disk I guess. Again not tried it but I would expect to be able to add partition to gain space, something you could try prior to reboot.

Stuart
Title: Re: Copy system disk using dd
Post by: roseway on February 05, 2017, 11:44:03 AM
1. Yes. What I've done in these circumstances is to edit /etc/fstab to replace the UUID references with the equivalent /dev/xxx references before cloning the disk.

On the subject of cloning, something like Clonezilla might be a better option than dd from the command line (but that's only a feeling, based on what I've done a couple of time).

2. Yes, something like Gparted Live will expand partitions as required.
Title: Re: Copy system disk using dd
Post by: sevenlayermuddle on February 05, 2017, 12:00:57 PM
Thanks Stuart, I will indeed hope to be installing the old disk too, with carefully chosen partitions that are rarely accessed, to mitigate the head noise.   I am aware I'll need to zap its partition table and repartition to bet new UUIDs, but you've made me think of a new issue... 

I wonder, will the cd booted environment in which I perform the dd copy get upset by the fact there are duplicate UUIDs, even if not mounted.   For example, If I type

ls -l /dev/disk/by-uuid

...then it shows me the UUID to device mapping, so the system is at least aware of unmounted UUIDs...

@Eric, also thanks.   I may play it safe by altering fstab as you suggest, and/or I will check out Clonezilla too.