Monday, August 2, 2021

Create SSD disk image & restore with dd on Ubuntu

Boot from Kubuntu Live USB flash drive.

Choose "Try Kubuntu".

*I deleted Swap partition with KDE Partition Manager just in case.

Ctrl + Alt + T


Check current disks.

kubuntu@kubuntu:~$ sudo fdisk -l

Disk /dev/loop0: 1.75 GiB, 1858924544 bytes, 3630712 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/nvme0n1: 238.49 GiB, 256060514304 bytes, 500118192 sectors

Disk model: TS256GMTE110S                           

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: gpt

Disk identifier: 6A76AEF7-D60C-4CA8-A4F2-9053CCDB5F29


Device             Start       End   Sectors   Size Type

/dev/nvme0n1p1      2048   1023999   1021952   499M Windows recovery environment

/dev/nvme0n1p2   1024000   1228799    204800   100M EFI System

/dev/nvme0n1p3   1228800   1261567     32768    16M Microsoft reserved

/dev/nvme0n1p4   1261568 421232563 419970996 200.3G Microsoft basic data

/dev/nvme0n1p5 421232640 422209535    976896   477M Linux filesystem

/dev/nvme0n1p6 422209536 485373951  63164416  30.1G Linux filesystem



Disk /dev/sda: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors

Disk model: WDC WD1002FAEX-0

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x6e87ea35


Device     Boot Start        End    Sectors   Size Id Type

/dev/sda1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT



Disk /dev/sdb: 465.78 GiB, 500107862016 bytes, 976773168 sectors

Disk model: SAMSUNG HN-M500M

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disklabel type: dos

Disk identifier: 0x91ca82e5


Device     Boot Start       End   Sectors   Size Id Type

/dev/sdb1        2048 976769023 976766976 465.8G  7 HPFS/NTFS/exFAT



Disk /dev/sdc: 7.47 GiB, 8009023488 bytes, 15642624 sectors

Disk model: Mass-Storage    

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x0011e9c1


Device     Boot Start      End  Sectors  Size Id Type

/dev/sdc1  *     2048 15642623 15640576  7.5G  c W95 FAT32 (LBA)


Check mount points.

kubuntu@kubuntu:~$ mount

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0

udev /dev devtmpfs rw,nosuid,noexec,relatime,size=8121840k,nr_inodes=2030460,mode=755 0 0

devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0

tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=1640672k,mode=755 0 0

/dev/sdc1 /cdrom vfat ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0

/dev/loop0 /rofs squashfs ro,noatime 0 0

/cow / overlay rw,relatime,lowerdir=/filesystem.squashfs,upperdir=/cow/upper,workdir=/cow/work 0 0

securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0

tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0

tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0

tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0

cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0

cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0

pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0

efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0

none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0

cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0

cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0

cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0

cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0

cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0

cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0

cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0

cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0

cgroup /sys/fs/cgroup/rdma cgroup rw,nosuid,nodev,noexec,relatime,rdma 0 0

cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0

cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0

systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=25963 0 0

mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0

tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0

debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0

hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0

tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0

fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0

configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0

tmpfs /run/user/999 tmpfs rw,nosuid,nodev,relatime,size=1640668k,mode=700,uid=999,gid=999 0 0

/dev/nvme0n1p6 /media/kubuntu/d469e0bf-c759-49fd-90a5-c0b21ea27f92 ext4 rw,nosuid,nodev,relatime 0 0

/dev/sda1 /media/kubuntu/1A7A02E67A02BF0F fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

/dev/sdb1 /media/kubuntu/FCBC33EEBC33A1D6 fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

/dev/nvme0n1p5 /media/kubuntu/fcd094f0-7812-4d60-9363-ac17b9017089 ext4 rw,nosuid,nodev,relatime 0 0


Now create image in target location.

kubuntu@kubuntu:~$ sudo dd if=/dev/nvme0n1 of=/media/kubuntu/1A7A02E67A02BF0F/linux.img bs=8192 count=30335872 status=progress

248482840576 bytes (248 GB, 231 GiB) copied, 3000 s, 82.8 MB/s

30335872+0 records in

30335872+0 records out

248511463424 bytes (249 GB, 231 GiB) copied, 3000.41 s, 82.8 MB/s


Check new disks.

kubuntu@kubuntu:~$ sudo fdisk -l

Disk /dev/loop0: 1.75 GiB, 1858924544 bytes, 3630712 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/nvme0n1: 232.91 GiB, 250059350016 bytes, 488397168 sectors

Disk model: Samsung SSD 970 EVO Plus 250GB          

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: gpt

Disk identifier: 073DD964-28FD-B148-AED7-8580C7C85933



Disk /dev/sda: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors

Disk model: WDC WD1002FAEX-0

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x6e87ea35


Device     Boot Start        End    Sectors   Size Id Type

/dev/sda1        2048 1953521663 1953519616 931.5G  7 HPFS/NTFS/exFAT



Disk /dev/sdb: 465.78 GiB, 500107862016 bytes, 976773168 sectors

Disk model: SAMSUNG HN-M500M

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 4096 bytes

I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disklabel type: dos

Disk identifier: 0x91ca82e5


Device     Boot Start       End   Sectors   Size Id Type

/dev/sdb1        2048 976769023 976766976 465.8G  7 HPFS/NTFS/exFAT



Disk /dev/sdc: 7.47 GiB, 8009023488 bytes, 15642624 sectors

Disk model: Mass-Storage    

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x0011e9c1


Device     Boot Start      End  Sectors  Size Id Type

/dev/sdc1  *     2048 15642623 15640576  7.5G  c W95 FAT32 (LBA)


Check mount points.

kubuntu@kubuntu:~$ mount

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0

udev /dev devtmpfs rw,nosuid,noexec,relatime,size=8121840k,nr_inodes=2030460,mode=755 0 0

devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0

tmpfs /run tmpfs rw,nosuid,nodev,noexec,relatime,size=1640672k,mode=755 0 0

/dev/sdc1 /cdrom vfat ro,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0

/dev/loop0 /rofs squashfs ro,noatime 0 0

/cow / overlay rw,relatime,lowerdir=/filesystem.squashfs,upperdir=/cow/upper,workdir=/cow/work 0 0

securityfs /sys/kernel/security securityfs rw,nosuid,nodev,noexec,relatime 0 0

tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0

tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0

tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0

cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0

cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0

pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0

efivarfs /sys/firmware/efi/efivars efivarfs rw,nosuid,nodev,noexec,relatime 0 0

none /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0

cgroup /sys/fs/cgroup/rdma cgroup rw,nosuid,nodev,noexec,relatime,rdma 0 0

cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0

cgroup /sys/fs/cgroup/net_cls,net_prio cgroup rw,nosuid,nodev,noexec,relatime,net_cls,net_prio 0 0

cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0

cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0

cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0

cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0

cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0

cgroup /sys/fs/cgroup/hugetlb cgroup rw,nosuid,nodev,noexec,relatime,hugetlb 0 0

cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0

cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0

systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1547 0 0

mqueue /dev/mqueue mqueue rw,nosuid,nodev,noexec,relatime 0 0

tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec,relatime 0 0

debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0

hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0

tmpfs /tmp tmpfs rw,nosuid,nodev,relatime 0 0

fusectl /sys/fs/fuse/connections fusectl rw,nosuid,nodev,noexec,relatime 0 0

configfs /sys/kernel/config configfs rw,nosuid,nodev,noexec,relatime 0 0

tmpfs /run/user/999 tmpfs rw,nosuid,nodev,relatime,size=1640668k,mode=700,uid=999,gid=999 0 0

/dev/sda1 /media/kubuntu/1A7A02E67A02BF0F fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

/dev/sdb1 /media/kubuntu/FCBC33EEBC33A1D6 fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0


Now restore disk image to new SSD drive.

*Created GPT table on new nvme0n1 with KDE Partition Manager just in case.

kubuntu@kubuntu:~$ sudo dd if=/media/kubuntu/1A7A02E67A02BF0F/linux.img of=/dev/nvme0n1 status=progress

248486584832 bytes (248 GB, 231 GiB) copied, 3502 s, 71.0 MB/s

485373952+0 records in

485373952+0 records out

248511463424 bytes (249 GB, 231 GiB) copied, 3503.76 s, 70.9 MB/s


!!! LINUX RESTORE FAILED !!!

I MANAGED TO RESTORE WINDOWS BUT FAILED TO RESTORE LINUX

I restored Kubuntu with Aomei Backupper from image made in case of dd failure. It's a pity I forgot to Export Partition Table with KDE Partition Manager. Maybe that will do the trick... Anyway it's better to backup and restore into larger drive. Removed swap but it didn't work out. Till next migration...

No comments:

Post a Comment