Properly verifying a Linux Mint Debian image and how to properly write it to a USB flash drive

When making a Linux Mint Debian Edition flash drive we follow the procedures below to ensure every flash drive is made from an image downloaded that is authentic, properly and fully written to the drive, and matches what is suppose to be one the drive post-write. The version below will of course be adjusted for the latest release from the steps followed below.



1. Download Linux Mint Debian Edition from the official website and associated files: https://linuxmint.com/download_lmde.php

cd Downloads
mkdir lmde7
cd lmde7

wget https://mirrors.seas.harvard.edu/linuxmint/debian/lmde-7-cinnamon-64bit.iso
wget https://mirrors.kernel.org/linuxmint/debian/sha256sum.txt
wget https://mirrors.kernel.org/linuxmint/debian/sha256sum.txt.gpg

2. Import the official Linux Mint signing key:

gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key "27DE B156 44C6 B3CF 3BD7 D291 300F 846B A25B AE09"

3. Verify the sha256sum.txt file has been signed by Linux Mint's developers

gpg --verify sha256sum.txt.gpg sha256sum.txt

4. Unmount any automatically mounted partitions:

sudo fdisk -l

umount /dev/sda1

5. Write the downloaded ISO file to the USB flash drive:

sudo dd if=lmde-7-cinnamon-64bit.iso of=/dev/sda bs=4M

6. Make sure all data is flushed to the drive:

sync

7. Find out the number of bytes the ISO takes up:

curl -s -L -I https://mirrors.seas.harvard.edu/linuxmint/debian/lmde-7-cinnamon-64bit.iso | grep 'content-length\|Content-Length'

8. Use the number of bytes from the output to read in the data from the USB flash drive and send it to sha256sum to ensure everything matches what's suppose to be there (a final corruption check):

sudo head -c 2960867328 /dev/sda | sha256sum

9.Verify the the output from sha256sum matches what is in the sha256sum.txt file:

cat sha256sum.txt