Linux dump hd

From test.coolscript.org
Revision as of 08:22, 31 May 2022 by Admin (talk | contribs) (Created page with " SSH Copy: root@raspberrypi:~ # dd if=/dev/mmcblk0 of=/mnt/data/clonetest.iso 3901440+0 records in 3901440+0 records out 1997537280 bytes (2.0 GB, 1.9 GiB) copied, 278.75 s,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


SSH Copy:

root@raspberrypi:~ # dd if=/dev/mmcblk0 of=/mnt/data/clonetest.iso 3901440+0 records in 3901440+0 records out 1997537280 bytes (2.0 GB, 1.9 GiB) copied, 278.75 s, 7.2 MB/s


apt-get install sshfs sshfs -o idmap=user vmadmin@192.168.178.67:/data /data

root@raspberrypi:~ # sshfs -o idmap=user vmadmin@192.168.178.67:/data /mnt vmadmin@192.168.178.67's password:

root@raspberrypi:~ # mount | grep ssh vmadmin@192.168.178.67:/data on /mnt type fuse.sshfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0)


root@raspberrypi:~ # dd if=/dev/mmcblk0 of=/mnt/clonetest.iso 7864320+0 records in 7864320+0 records out 4026531840 bytes (4.0 GB, 3.8 GiB) copied, 571.822 s, 7.0 MB/s





Workshop, Copy attached disk to ISO

root@raspberrypi:~ # fdisk -l /dev/sda Disk /dev/sda: 3.75 GiB, 4026531840 bytes, 7864320 sectors Disk model: STORAGE DEVICE 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: 0x4808f986

Device Boot Start End Sectors Size Id Type /dev/sda1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/sda2 532480 7864286 7331807 3.5G 83 Linux root@raspberrypi:~ # df -h | grep mnt /dev/sdb1 7.3G 92K 6.9G 1% /mnt

root@raspberrypi:~ # mkfs.vfat /dev/sdb1 mkfs.fat 4.2 (2021-01-31)

root@raspberrypi:~ # df -h | grep mnt /dev/sdb1 7.4G 4.0K 7.4G 1% /mnt

root@raspberrypi:~ # dd if=/dev/sda of=/mnt/clonetest.iso 7864320+0 records in 7864320+0 records out 4026531840 bytes (4.0 GB, 3.8 GiB) copied, 432.071 s, 9.3 MB/s

root@raspberrypi:~ # ls /mnt -allh total 3.8G drwxr-xr-x 2 root root 4.0K Jan 1 1970 . drwxr-xr-x 19 root root 4.0K Mar 12 18:55 .. -rwxr-xr-x 1 root root 3.8G May 28 20:30 clonetest.iso



dd if=/dev/mmcblk0 of=/mnt/clonetestX.iso Disk /dev/mmcblk0: 1.86 GiB, 1997537280 by


Copy the impage back

source: root@raspberrypi:~ # fdisk -l /dev/sda Disk /dev/sda: 3.75 GiB, 4026531840 bytes, 7864320 sectors Disk model: STORAGE DEVICE 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: 0xf92737c6

Device Boot Start End Sectors Size Id Type /dev/sda1 32 7864319 7864288 3.7G c W95 FAT32 (LBA)


root@raspberrypi:~ # dd if=/mnt/clonetest.iso of=/dev/sda 7864320+0 records in 7864320+0 records out 4026531840 bytes (4.0 GB, 3.8 GiB) copied, 1095.98 s, 3.7 MB/s



Prepare SSH Filesystem root@raspberrypi:~ # apt-get install sshfs


root@raspberrypi:~ # sshfs -o allow_other,default_permissions vmadmin@192.168.178.67:/ /mnt vmadmin@192.168.178.67's password: root@raspberrypi:~ # ls /mnt/ bin data etc initrd.img lib lib64 lost+found mnt proc run srv tmp var vmlinuz.old boot dev home initrd.img.old lib32 libx32 media opt root sbin sys usr vmlinuz root@raspberrypi:~ # ls /mnt/data/ root@raspberrypi:~ #



Workshop: Clone 4GB Test OS (sda) to an new disk, sdb 8GB

root@raspberrypi:~ # fdisk -l /dev/sda Disk /dev/sda: 3.75 GiB, 4026531840 bytes, 7864320 sectors Disk model: STORAGE DEVICE 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: 0x4808f986

Device Boot Start End Sectors Size Id Type /dev/sda1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/sda2 532480 7864286 7331807 3.5G 83 Linux



root@raspberrypi:~ # fdisk -l /dev/sdb Disk /dev/sdb: 7.4 GiB, 7948206080 bytes, 15523840 sectors Disk model: STORAGE DEVICE 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: 0x6e3100da

Device Boot Start End Sectors Size Id Type /dev/sdb1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/sdb2 532480 15523839 14991360 7.1G 83 Linux


Clone Disk: root@raspberrypi:~ # dd if=/dev/sda of=/dev/sdb 7864320+0 records in 7864320+0 records out 4026531840 bytes (4.0 GB, 3.8 GiB) copied, 1118.79 s, 3.6 MB/s

Compare the result root@raspberrypi:~ # fdisk -l /dev/sdb Disk /dev/sdb: 7.4 GiB, 7948206080 bytes, 15523840 sectors Disk model: STORAGE DEVICE 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: 0x4808f986

Device Boot Start End Sectors Size Id Type /dev/sdb1 8192 532479 524288 256M c W95 FAT32 (LBA) /dev/sdb2 532480 7864286 7331807 3.5G 83 Linux

root@raspberrypi:~ #