Is it safe to clone the current used disk

Solution 1:

As it is safe to bitwise clone an unmounted hard drive using dd we should not do so from a mounted drive which is in use. This is especially true for the mounted system drive.

It is not recommended to clone the system drive of a running system because we inevitably will have data inconsistencies from cloning files where the system will currently write to.

Nevertheless it is possibly to almost clone a running system after we had excluded our used system files from being copied.

It is at least the content of system directories below we should exclude from our backup copy. The content of these directories will be created on boot time but note that the directories will not be created, therefore we have to copy these, but exclude their content Source:Arch Wiki:

/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found

We may also want exclude the trash, or other directories from /home/ to speed up the backup process.

Such an exclusion can nicely be done with rsync Install rsync resulting in a command similar to this:

sudo rsync -avxAX /* /backup/directory --exclude={/dev/*,/proc/*,/sys/*,/tmp/*,/run/*,/mnt/*,/media/*,/lost+found}

This command should further be adapted to meet our personal needs (see [manpage for the rsync command]. Note that we may want to omit the option -x in case we also want to copy a source on multiple filesystems. We then should also exclude .gvfs to avoid copying GFVS mounted contents there.

Of course the master boot sector, partition boot sectors, partition tables, and format of the source drive will not be copied by this. We will have to partition the backup drive before we are able to "clone" the source with rsync. We may also have to install Grub to this drive in case we want to also be able to boot from this drive.

Still many files from the source system may not be really needed in the cloned system (think of old packages, kernels, etc.). Therefore rather than cloning a system we may be better off performing a backup of our source to restore it somewhere else.

  • How to backup settings and list of installed packages

Solution 2:

From what I understand, you are trying to clone a hard drive that is currently in use.

I wouldn't recommend cloning whilst it's still in use. The software might refuse to perform the task (e.g. GParted won't move/resize with mounted/in use partions/hard drives). It might be possible since all you are doing is copying the what's on the hard drive (as opposed to moving the data to another hard drive). How are you going to clone it?

Is the software you are using to clone it on the same hard drive or a separate one. If it's separate, then try to unmount the hard drive before cloning. I'd normally suggest booting into a live CD or live USB of a linux OS or partitioning program (e.g. Ubuntu, GParted), but you say that you can't turn off the computer.

The way I see it, cloning is similar to copying files, and (since copying files with the disk in use is safe) it would appear to be safe to clone it. I'm not entirely sure, but that's all I can offer at the moment.

I don't see any problems with the process, but I'm not experienced with 'cloning' and I'm not entirely sure of how safe it is.