Thomas-Tsai / partclone

Partclone provides utilities to backup a partition smartly and it is designed for higher compatibility of the file system by using existing library.
GNU General Public License v2.0
306 stars 104 forks source link

Feature request: Clone an already mounted disk drive #233

Closed TaylorTrz closed 1 year ago

TaylorTrz commented 1 year ago

Recently I found this project from Clone zilla. So i tried to backup/clone my ubuntu18.04 server root disk drive, for example:

partclone.ext4 -d -c -s /dev/sda1 -o /mnt/testpartclone.img

But the error cames to me:

Starting to clone device (/dev/sda1) to image (/mnt/test-partclone.img)
UID is root.
source=/dev/sda1, target=/mnt/test-partclone.img
open source file/device /dev/sda1
device (/dev/sda1) is mounted at /boot
error exit

And i can see other people had already issue on this. But why clone action can'nt be doned on an already mounted disk? For data consistency or ? Looking forward to you reply.

Thomas-Tsai commented 1 year ago

Clone action can't be done on an already mounted disk because it's a block-based backup tool. It's like dd, but partclone finds all the used blocks in Bitmap before cloning. In seeing all used blocks, partclone has to open (like mount) a clean file system, and normally status is closed or unmounted. If you have already mounted the partition, the bitmap information is incorrect making you backup error blocks.

TaylorTrz commented 1 year ago

Thanks for you reply. This answer calls an end to my feature request.

TaylorTrz commented 1 year ago

Done.