Writing to a UDF WORM SD card in Linux

1

I'm looking into getting some Sandisk 1GB WORM SD cards for archiving things. I assume they appear to the OS as a block device (they're SD, after all). I noticed that mkudffs supports a worm media type. I tried testing this with a file:

# dd if=/dev/zero of=worm.img bs=1M count=16
# mkudffs --blocksize=512 --media-type=worm worm.img
# mount -o loop worm.img /mnt/worm/

But the filesystem isn't enforcing WORM:

/mnt/worm# dd if=/dev/urandom of=foo
dd: writing to `foo': No space left on device
31329+0 records in
31328+0 records out
16039936 bytes (16 MB) copied, 1.27185 s, 12.6 MB/s
/mnt/worm# rm foo
/mnt/worm# dd if=/dev/urandom of=bar
dd: writing to `bar': No space left on device
31329+0 records in
31328+0 records out
16039936 bytes (16 MB) copied, 1.19381 s, 13.4 MB/s

If the FS actually enforced WORM, delete might work, but I wouldn't be able to write 16 MB twice.

So my questions:

  • Would a WORM SD really just appear as a block device? Would writes to already-written blocks fail? Would empty blocks just be zeros?
  • Am I misunderstanding what UDF WORM is supposed to do?
  • Would UDF WORM work if I had an actual WORM device? Is there a way to test this with a loopback device?
  • Any other suggestions for doing this? Finding 100-year media I trust is tricky

David Ehrmann

Posted 2013-10-17T17:49:47.210

Reputation: 161

do you find a solution for WORM SD card? I'm looking for it. – Tobia – 2016-02-05T18:55:30.270

Answers

1

It turns out a German company named Altec developed a drive and software for writing to Sandisk WORM devices. The device looks like (but I'm not sure) just a typical USB SD card reader. The software, however, is interesting. It somehow can write and update files in a WORM version of FAT that might even mount as an ordinary FAT FS.

They open sourced bits of their code (in the event they or the technology disappears, and the technology did). There's a file named WormHugeFile.cpp with implementation details for the WORM bit of all this. Basically, Sandisk created vendor-specific SCSI opcodes for WORM operation. You can query the device to see if it's a WORM device, switch it between WORM and ROM mode, open and close it for WORM writing, and mark it as read-only.

Out of the box, these cards seem to be in "ROM" mode and act like normal SD cards.

As for the UDF bits, UDF does support WORM media, but the Linux UDF driver driver doesn't currently have that support; it sees a UDF FS in WORM mode as a RW UDF FS.

David Ehrmann

Posted 2013-10-17T17:49:47.210

Reputation: 161