Linux Mint: Disk image

From fit-PC wiki
Revision as of 11:12, 12 November 2019 by Denis (Talk | contribs)

Jump to: navigation, search

Instructions for disk image preparation:

1. Obtain Linux workstation PC. Any recent Linux distribution is ok

2. Open the terminal and print current partitions

$ cat /proc/partitions

3. Attach the disk you are going to clone to the workstation PC and print detected partitions again:

$ cat /proc/partitions
8       80 30932992 sdf
8       81  2929664 sdf1
8       82    97280 sdf2
8       83    97280 sdf3
8       84   488448 sdf4

In the example above attached disk named /dev/sdf and it has 4 partitions: /dev/sdf1, /dev/sdf2, /dev/sdf3, /dev/sdf4

4. Open the terminal and save disk layout using fdisk tool:

$ echo -e "O\nfdisk.layout\nq\n" | sudo fdisk /dev/sdf
$ cat fdisk.layout
label: dos
label-id: 0x5a0ae517
device: /dev/sdf
unit: sectors

/dev/sdf1 : start=        2048, size=     5859328, type=83
/dev/sdf2 : start=     5861376, size=      194560, type=ef
/dev/sdf3 : start=     6055936, size=      194560, type=4
/dev/sdf4 : start=     6250496, size=      976896, type=83

5. Open the terminal and save disk layout using blkid tool:

$  sudo blkid /dev/sdf* -s UUID -s TYPE > blkid.layout
$ cat blkid.layout
/dev/sdf1: UUID="34b4205b-d2b9-4e50-9ea1-c559fdab97d3" TYPE="ext4"
/dev/sdf2: UUID="52DE-F66C" TYPE="vfat"
/dev/sdf4: UUID="025c89f7-eb46-424b-883b-23f7f0771b27" TYPE="ext4"

6. Save filesystem from each disk partition using partclone tool and compress using lz4 tool partclone tool supports: NTFS,EXT2/3/4,FAT and many other filesystem types Install required cloning software: "liblz4-tool" and "partclone"

# for distributions based on Ubuntu/Debian
$ sudo apt update
$ sudo apt install liblz4-tool partclone

In the example above according to blkid.layout:

/dev/sdf1 and /dev/sdf3 have "ext4" filesystem
/dev/sdf2 has "vfat" filesystem
/dev/sdf3 has no filesystem

According to the example need to save 3 partitions:

$ sudo partclone.ext4 -c -s /dev/sdf1 | lz4 > part1.ext4.partclone.lz
$ sudo partclone.vfat -c -s /dev/sdf2 | lz4 > part2.vfat.partclone.lz
$ sudo partclone.ext4 -c -s /dev/sdf4 | lz4 > part4.ext4.partclone.lz

7. Calculate md5 for files you've preprared

$ md5sum *.layout part* .partclone.lz > md5sum

8. Send us the fdisk.layout, blkid.layout and all part*.partclone.lz files and the md5 file