• Clone the disk partition data into an IMG file with dd in the way simil

    From hongyi.zhao@gmail.com@21:1/5 to All on Fri Aug 20 05:22:11 2021
    See the following testing:

    $ sudo partclone.ext4 -c -s /dev/nvme0n1p2 -o aaa.img
    Partclone v0.3.13 http://partclone.org
    Starting to clone device (/dev/nvme0n1p2) to image (aaa.img)
    Reading Super Block
    Calculating bitmap... Please wait...
    Elapsed: 00:00:01, Remaining: 00:00:00, Completed: 100.00%
    Total Time: 00:00:01, 100.00% completed!
    done!
    File system: EXTFS
    Device size: 26.2 GB = 6400000 Blocks
    Space in use: 9.4 GB = 2299940 Blocks
    Free Space: 16.8 GB = 4100060 Blocks
    Block size: 4096 Byte
    Elapsed: 00:00:34, Remaining: 00:00:00, Completed: 100.00%, Rate: 16.62GB/min, current block: 6400000, total block: 6400000, Complete: 100.00%
    Total Time: 00:00:34, Ave. Rate: 16.6GB/min, 100.00% completed!
    Syncing... OK!
    Partclone successfully cloned the device (/dev/nvme0n1p2) to the image (aaa.img)
    Cloned successfully.

    $ du -h aaa.img
    8.8G aaa.img

    As you can see, the partclone tool let me clone the real blocks used on the disk part into an IMG file which can be used to restore to another disk partition later.

    I want to know if I can use dd to achieve the same purpose.

    Regards,
    HY

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From David W. Hodgins@21:1/5 to hongy...@gmail.com on Fri Aug 20 14:16:02 2021
    On Fri, 20 Aug 2021 08:22:11 -0400, hongy...@gmail.com <hongyi.zhao@gmail.com> wrote:
    As you can see, the partclone tool let me clone the real blocks used on the disk
    part into an IMG file which can be used to restore to another disk partition later.
    I want to know if I can use dd to achieve the same purpose.

    The dd program does a device to device exact copy. It works with other files too,
    making a byte for byte copy.

    Adding the sparse option will reduce the output file space used, if the input file
    has blocks that are entirely binary zero.

    It will not copy just the blocks used by currently allocated files. Deleted files
    that have not been overwritten will be copied too.

    So it isn't the same as a partclone image, but can lead to similar results.

    Regards, Dave Hodgins

    --
    Change dwhodgins@nomail.afraid.org to davidwhodgins@teksavvy.com for
    email replies.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From hongyi.zhao@gmail.com@21:1/5 to David W. Hodgins on Sat Aug 21 04:43:39 2021
    On Saturday, August 21, 2021 at 2:16:14 AM UTC+8, David W. Hodgins wrote:
    On Fri, 20 Aug 2021 08:22:11 -0400, hongy...@gmail.com <hongy...@gmail.com> wrote:
    As you can see, the partclone tool let me clone the real blocks used on the disk
    part into an IMG file which can be used to restore to another disk partition later.
    I want to know if I can use dd to achieve the same purpose.
    The dd program does a device to device exact copy. It works with other files too,
    making a byte for byte copy.

    Adding the sparse option will reduce the output file space used, if the input file
    has blocks that are entirely binary zero.

    It will not copy just the blocks used by currently allocated files. Deleted files
    that have not been overwritten will be copied too.

    So it isn't the same as a partclone image, but can lead to similar results.

    Thank you for your comments. So, the image file generated by partclone will have smaller size in any case.

    HY

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)