dumbnoobidiot
Posts: 1
Joined: Mon Mar 30, 2020 2:33 am

Little knowledge, just an idea, need a learning starting point

Mon Mar 30, 2020 2:43 am

I know very little about computers. I know enough that I was able to put together my own desktop, and I have a pretty good grasp of programming (I've played around with Unity here and there), but beyond that, I don't even know what I don't know. And I got this idea that, at the very least, I think would be cool. (A matter of opinion, of course.)

The idea goes like this: You have a battery powered device attached to a usb flash drive. While the device is off, you can use the flash drive normally. However, with the flip of a switch, the device turns on and erases everything on the flash drive.

I do believe I could cobble something together... eventually? But there would be a lot of grasping in the dark before I had something that wasn't completely embarrassing to look at.

So, my question is this: What do I need to learn so that I can make this as small and simple as possible?

User avatar
topguy
Posts: 6466
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Little knowledge, just an idea, need a learning starting point

Mon Mar 30, 2020 12:51 pm

Will the flash drive be in use when you turn the switch on ? or can you guarantee that will not happen ? Will the flashdrive be selfpowered ?

You will have to make sure that you dont have two compunters accessing the flashdisk at the same time so you would have to learn to electricly isolate the usb data-lines. So your task is more electronics than computers IMO.

W. H. Heydt
Posts: 12430
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Little knowledge, just an idea, need a learning starting point

Mon Mar 30, 2020 4:48 pm

Do you care whether you *erase* the contents of the USB stick, or will *destroying* the USB stick meet the goal?

User avatar
thagrol
Posts: 2961
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Little knowledge, just an idea, need a learning starting point

Mon Mar 30, 2020 10:28 pm

Consider this approach.

Instead of using an off the shelf USB flash drive use a large SD card and a Pi zero.

  1. Install raspbian lite on the SD card and do the usual first boot stuff.
  2. Create a big file somewhere on the SD card. As big as you want your virtual USB stick to appear to be on the host.
  3. Set up the zero as a USB mass storage gadget using the file created above as its backing store.
  4. Have a script running on the zero to wait for a button press then do this:
    1. Kill/rmmod the g_mass_storage module. That stops access from the USB host. We don't care whether the host has unwritten data in its write cache as we're going to erase the backing store anyway.
    2. Run a secure erase on the backing store. This will take a while and may need the storage to be mounted locally first.
    3. Optionally, repartition and reformat the backing store ready for the next use.

The above is just the essense of what you're trying to do. There are a whole host of other issues you'd need to deal with to make it robust and fully secure many of which would also apply if using a Pi as a middle man between the USB host and the USB flash drive.
Attempts to contact me outside of these forums will be ignored unless signed in triplicate, sent in, sent back, queried, lost, found, subjected to public enquiry, lost again, and finally buried in soft peat for three months and recycled as firelighters

mwrich4
Posts: 99
Joined: Wed Jul 25, 2012 1:24 pm
Location: Stuart, Florida

Re: Little knowledge, just an idea, need a learning starting point

Tue Mar 31, 2020 11:18 pm

Truly erasing flash take TIME.

If this is a panic mode ability, I suppose it's technically viable with another small autonomous processor. But it's a LOT of design work as stated above.

Otherwise, most of us just insert and delete in a system.

User avatar
Botspot
Posts: 1241
Joined: Thu Jan 17, 2019 9:47 pm
Location: Texas
Contact: Website

Re: Little knowledge, just an idea, need a learning starting point

Wed Apr 01, 2020 8:39 pm

dumbnoobidiot wrote:
Mon Mar 30, 2020 2:43 am
You have a battery powered device attached to a usb flash drive. While the device is off, you can use the flash drive normally. However, with the flip of a switch, the device turns on and erases everything on the flash drive.
Question: Does this "battery powered device" NEED to be attached to the usb flash drive AT ALL TIMES? If so it needs to be very small.

Sounds like you want a device that will erase everything on the usb device. How about a standalone device? Plug in any usb storage device, push the button, and >BOOM<, contents erased.

Diagram:
usb_eraser.png
usb_eraser.png (24.07 KiB) Viewed 108 times
Want to make your own Raspbian image?
  • Hard way: Mess with confusing terminal commands.
  • Easy way: Let Pi-Power-Tools do it all for you!
Boot your image in a VM, Flash from the Internet at top speed, Mount (to drop files in), Edit partitions, Shrink/Expand, Repair, and more. Enjoy! :)
https://github.com/Botspot/Pi-Power-Tools

Return to “Beginners”