NOTE: dd command? ================================================================================= dd command當中的"dd",是什麼意思,有以下說法: * "Data Duplicator"(數據複製器) * "Disk Dump"(磁碟轉儲) * "Destroy Disk"(摧毀磁碟,因為錯誤使用可能會導致數據丟失) 由上可知,dd command可以用在: * 備份資料 * 還原資料至目標儲存空間(轉儲) * 透過將每個位元寫入空值的方式,將資料損毀 以下就是針對不同需求所製作的筆記 Create OS image --------------------------------------------------------------------------------- ### 透過**lsblk**找到目標硬碟,在將內部資料(作業系統)做成映像(image)備份 Command: `lsblk` ![image](https://hackmd.io/_uploads/By5A4_Whyx.png) ### 先使用**fdisk**指令,計算製作image file的大小 Command: `fdisk -l` ![image](https://hackmd.io/_uploads/ByfXw_Z3yg.png) 存入空間由**start**起始,終於**End**,所以輸入大小為**23175167** ### 使用**dd command + time**製作image並計算時間 Command: `time if=/dev/sdX of=example.img bs=512 status=progress count=23175167` ![image](https://hackmd.io/_uploads/B1X6qOZ3Jl.png) Result: ![image](https://hackmd.io/_uploads/BketouWnye.png) Restore OS image to Disk --------------------------------------------------------------------------------- 將image還原至USB command: `time dd if=<image_file> of=/dev/sdX status=progress` ![image](https://hackmd.io/_uploads/B1iQ3_WnJe.png) Wipe all data in Disk --------------------------------------------------------------------------------- (將整顆硬碟的資料透過寫入zero抹除,時間會偏久) Command: `time dd if=/dev/zero of=/dev/sdX bs=512 status=progress` ![image](https://hackmd.io/_uploads/rkdoZUS3kg.png) Ref. --------------------------------------------------------------------------------- [dd command info](https://blog.gtwang.org/linux/dd-command-examples/) [Securely Wipe Disks and Delete Files](https://brainfucksec.github.io/securely-wipe-disks-and-delete-files)