Can I create a /dev/sda image while it's being used by the running Linux?

0

I'm running a GNU/Linux system, but the hard drive is failing, so I want to make a complete disk image to copy it later to a replacement hard drive.

Can I run the dd command from system itself?

dd if=/dev/sda of=/external/disk/sda.dd

Should I rather shutdown the system, boot a LiveCD and do this when the disk is not actively used by a running operating system?

What could possibly go wrong if I don't?

unfa

Posted 2016-10-02T17:57:39.623

Reputation: 419

2

I think you technically can but you don't want to. The resulting image will most probably be inconsistent. This is what happens when you sequentially create an image of an object that can change its state during this operation.

– Kamil Maciorowski – 2016-10-02T18:07:45.673

Indeed, the image might be inconsistent, but if you're using a journalling filesystem (like ext3/4), then changes are that you'd be able to recover these inconsistencies. If you want the best guarantee of a consistent image then it's best to copy it while no partitions on the disk are mounted, e.g. from a live CD. – Jaap Eldering – 2016-10-12T00:48:31.653

No answers