BACKUP! Most Fun&Risky Part
Usig dd which stands for copy & compile or disk destroyer lol
Clone a disk
sudo dd if=/dev/sda of=/dev/sdb
💡Source disks:
Can be online
You should minimize writes during the operation
💡 Display status
status=progress
sudo dd if=/dev/sda of=/dev/sdb status=progress
Here is an example:
dd Command Line Options
sudo dd if=/dev/nvme0n1p15 of=/mnt/backup_boot_disk/boot.img status=progress conv=sync,noerror
💡 Ensure perfect copy
conv=sync
Very slow
Check all writes before progressing
💡 Increase block size 512 is default
bs=64K
bs=1M
By default “dd” run with 512 bytes which very small, for new linux distro you can go more with it
sudo dd if=/dev/nvme0n1p15 of=/mnt/backup_boot_disk/boot.img status=progress conv=sync,noerror bs=1M
Now, let’s say we just want the MBR to be backed up:
sudo dd if=/dev/nvme0n1 of=/mnt/backup_boot_disk/mbr.img count=1 bs=512
and with this you can capture the first 512 bytes
What about back up with compression? well, dd dosen’t have this ability to do this, but we can work around and achieve this by piping the input to gzip
sudo dd if=/dev/nvme0n1p15 bs=1M status=progress | gzip -c > /mnt/backup_boot_disk/boot.img.gz
and guess what !!
3.0M !! this is way smaller, i wasn’t waiting for this little tiny image
Restoring the disk: Just inverse the input with output, and make sure the disk you redirecting to is unmounted first
Last updated