write-protected usb flash drive

Arthur Chance freebsd at qeng-ho.org
Sat May 24 15:44:44 UTC 2014

On 24/05/2014 15:22, Gary Aitken wrote:
> On 05/24/14 00:01, Polytropon wrote:
>> On Fri, 23 May 2014 18:26:44 -0600, Gary Aitken wrote:
>>> I'm having trouble locating what I want --
>>> a physically write-protected flash drive.
>>> My searches so far have come up empty.
>>> Thought someone here would know of one if it exists.
>>> I don't want or need additional encryption gimicks on it.
>>> Anyone know of one?  32G or larger
>> I have been using something similar, even though it's not _exactly_
>> what you're asking for. My "solution" (haha): Get a SD card with
>> the required capacity and initialize it as intended. Then use the
>> write protection slider. The card is now write protected. Then get
>> a USB card drive (usually in the shape of a regular USB stick, for
>> example a USK SD/MMC/MS-MMC USB 2.0 card drive) and put the card in.
>> Now you have a write-protected USB drive. :-)
>> There are two advantages:
>> a) In case of media failure, just replace the SD card.
>> b) In case of reader failure, just replace the drive.
>> Additional fun: If you use a SD->µSD adapter, you can also use a
>> micro-SD card. The adapter then provides the write protection slider.
>> The mentioned advantages still apply. :-)
> I like this option better than the Kanguru one,
> mostly because the kanguru drives seem to not be very robust;
> lots of failures reported.
> I don't see why it wouldn't work, but have you tried formatting /
> initializing SD cards from the USB adapter instead of a device like a
> camera?

Wearing my paranoid sysadmin hat: given that the write protect switch on 
SD cards is purely advisory, it would be a good idea to check that the 
SD to USB adapter actually honours the advice. I.e. try to write to it 
with write protect on.

[Slight pause.]

OK, thought I'd better try my own advice rather than just handing it 
out. I put a microSD card out of an old phone into a SanDisk mSD -> SD 
adapter and plugged that into my SanDisk SD -> USB adapter, mounted it 
(FAT32 file system already on it) and wrote a file to it. Worked as 
you'd expect. I then unmounted and unplugged it, flipped the write 
protect switch and tried to remount. Result was

mount_msdosfs: /dev/da5s1: Input/output error

Mounting it read-only was fine. So, the write protect is honoured by at 
least some SD -> USB adapters. Looks like Polytropn's idea is the way to 
go if you want write protectable USB flash drives. The one I've got is a 
SanDisk MicroMate Reader, it's USB 2.0 and can handle cards up to 32GB, 
so it's just on the edge of what you need. I'd guess there's probably a 
USB 3.0 version around by now.

As for formatting SD cards via a USB adapter, I've done that quite 
often. So far I've written disk images using dd (for RPi), used 
newfs_msdos for both FAT16 and FAT32 and plain newfs for UFS2 
filesystems, all without problem.

More information about the freebsd-questions mailing list