Creating disk image with Ubuntu Live

First, connect to Ubuntu Live with SSH:

sudo apt-get update
sudo apt-get install ssh
sudo passwd ubuntu

List disks and partitions:

NAME        FSTYPE     SIZE MOUNTPOINT                         LABEL
loop0       squashfs   2.3G /rofs
loop1       squashfs     4K /snap/bare/5
loop2       squashfs  61.9M /snap/core20/1405
loop3       squashfs  81.3M /snap/gtk-common-themes/1534
loop4       squashfs 248.8M /snap/gnome-3-38-2004/99
loop5       squashfs  43.6M /snap/snapd/15177
loop6       squashfs  45.9M /snap/snap-store/575
loop7       squashfs 155.6M /snap/firefox/1232
loop8       squashfs   284K /snap/snapd-desktop-integration/10
sda                   14.5G
└─sda1      vfat      14.5G /cdrom                             UBUNTU 22_0
sdb                  298.1G
├─sdb1      vfat       200M                                    EFI
└─sdb2      ntfs     297.9G /media/ubuntu/External HDD         External HDD
nvme0n1              476.9G
├─nvme0n1p1 ntfs       529M                                    Recovery
├─nvme0n1p2 vfat       100M
├─nvme0n1p3             16M
├─nvme0n1p4 ntfs     119.4G
└─nvme0n1p5 apfs     356.9G
df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           1.6G  2.2M  1.6G   1% /run
/dev/sda1        15G  3.5G   12G  24% /cdrom
/cow            7.8G  181M  7.6G   3% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M  8.0K  5.0M   1% /run/lock
tmpfs           7.8G     0  7.8G   0% /tmp
tmpfs           1.6G  144K  1.6G   1% /run/user/999
/dev/sdb2       298G   99M  298G   1% /media/ubuntu/External HDD

Then try dd:

cd /media/ubuntu/External\ HDD/
sudo dd if=/dev/nvme0n1p4 of=./nvme0n1p4.image

or with Pipe Viewer:

sudo apt-get install pv
sudo dd if=/dev/nvme0n1p4 | pv | dd of=./nvme0n1p4.image

or with compression:

sudo dd if=/dev/nvme0n1p5 status=progress | bzip2 > ./nvme0n1p5.image.bz2

restoring with decompression:

bzcat nvme0n1p5.image.bz2 | sudo dd of=/dev/nvme0n1p5 status=progress
383185695232 bytes (383 GB, 357 GiB) copied, 6650 s, 57.6 MB/s
748554888+0 records in
748554888+0 records out
383260102656 bytes (383 GB, 357 GiB) copied, 6653.1 s, 57.6 MB/s

Leave a Reply

Your email address will not be published. Required fields are marked *