Life Skills, Technology, Tutorial, Ubuntu

How to Reformat or Repurpose an Encrypted Hard Drive

I had a super old 1 gigabyte flash drive. Good for nothing, other than backing up my Keepass files. Unfortunately, though, I had encrypted this thing and couldn’t even reformat it in the ‘usual ways’ on ubuntu because of the encryption.

This thread ultimately held the answer for me but I wanted to expand a bit on it because there are some risks here and it’s also not as difficult as it seems by reading.

I didn’t have time to learn, install, figure out, etc mkusb from this thread and I already knew that the ol’ dd command is an old fashioned shotgun ready to do anything you want to any drive. So I focused on that and succeeded.

First, I used a computer that I was ‘less concerned’ about since I had one. If you don’t, it’s ok, but just be slower and more careful because the dd command can wipe anything including the very computer OS you are running the command on!

Here are the steps I did to repurpose my old encrypted flash drive and you should be able to apply this to any drive:

  1. booted with a live ubuntu install drive
  2. selected ‘try ubuntu’ to make sure I’m running on the live usb drive
  3. open a terminal
  4. run lsblk and take a good, long, hard look at all the drives before you insert the drive you are going to wipe. This is a habit I have which helps me know more clearly and accurately which is the target drive so I don’t make an error. In my case here, I saw sda (my main drive) broken out into sda1, 2, etc), sdb (my live ubuntu drive) and it matched the size so I felt confident about that.
  5. Insert your target encrypted drive
  6. run lsblk again. You should see clearly the new addition (perhaps sdc?) showing the correct size of the drive, etc. Now that you are 100% confident, you can run the death command on the drive. In my example, I’m using sdc, but yours could be different. Use the right drive. Here is the command

dd if=/dev/zero of=/dev/sdc

What happens next is (I guess) it goes through the entire drive and fills it up with useless zeros. I know this because this was the final message before it stopped:

dd: writing to /dev/sdc/: no space left on device’ and then a few other lines

  1. Remove disk and re-insert to make sure it’s somewhat alive (may not be required but I do this)
  2. open ‘disks’ app in ubuntu
  3. On the left pane you should see your drive now. It won’t just pop up when you insert the drive because it’s not formatted with anything.
  4. With the gear icon under the big orange stripe, select ‘format partition’
  5. Select your formatting options. In my case I’m choosing ‘password protect’ again and re-encrypting it so I can put my keepass files on there with more comfort
  6. Remove drive and re-insert to test again (especially your encryption password)
  7. Enjoy your repurposed drive!

I hope some or all of this helped one or more of you….

Leave a Reply

Your email address will not be published. Required fields are marked *