dd this, dd that
Contents
- Step 0: Check the drive
- Step 1: Wipe the headers
- Step 2: Remove GPT data
- Step 3: Clean the remnants of partition
- Step 4: Verify image checksum
- Final Step: Let's clone it!
- Finished
Basic procedure on dd
ing the image to your flash drive.
Making things simple, we will use 4 of the powerful commands on linux just to dd
the stuff on drive.
Step 0: Check the drive
I can't emphasize this enough but one of the basic mistake by noobies is to copy the commands without understanding their function. This includes the drive name too, so make sure you are using the correct drive to work with as THIS WILL REALLY FUCK UP YOUR DATA IF DONE WRONG.
# Match the device id and its size mentioned in outupt with your corresponding drive.
Step 1: Wipe the headers
Some drives even after wiping will have associated partition table information that can result in corruption of data and in many cases making drive invalid. To clean this, wipefs
utility will be used.
# Make sure to select the correct device
Step 2: Remove GPT data
If you are using a Linux on a modern machine (with UEFI enabled), there is a high chance that your drive contains GPT (GUID Partition Table) in it. To clean this, sgdisk
utility will be used.
# Again, select the right device
Step 3: Clean the remnants of partition
Sometimes to protect drive from corruption, there are backup of partition tables on specific locations. This can cause faulty overwrites with the old partitioning to the new, if cloning an image. Good example of this is if flashing different Raspberry Pi images on same SD card. To clean this, shred
command will be used.
This command will select a random source, in our case /dev/urandom
and overwrite the bits on drive from random source.
# Last time, check if device is right. No crying afterwards!
Step 4: Verify image checksum
No matter from where you have downloaded disk image, you should always verify the image's hash signature only if obtained from trusted sources.
# Use the checksum only if the source obtained from is trusted.
# match the output of the command with your checksum
Final Step: Let's clone it!
Okay, so the final part is here. This one is much more simple to follow.
#
# Wait for this command to finish the cloning procedure
Finished
Final wording is, just check the drive to see if it's actually working or not.