Wednesday, November 17, 2021

[SOLVED] Mounting a read only drive as write

Issue

I have a special bespoke device with a USB interface. When plugging in the device to my laptop - Ubuntu 12.04 it mounts as a read only USB drive - with a file on it. This file is created by the device and writes to the file when the device scans stuff.

I however, want to be able to write to the drive so the device 'thinks' it has already scanned x amount of entries.

Basically I want to replace the file 'File1.txt' my version of 'File1.txt' however I cannot because the drive is mounting as Read only.

I have tried the following commands:

andy@andy-ThinkPad-W530:/media/iRead$ touch giveme.txt
touch: cannot touch `giveme.txt': Read-only file system
andy@andy-ThinkPad-W530:/media/iRead$ sudo mount -o remount,rw '/media/iRead'
[sudo] password for andy: 
mount: cannot remount block device /dev/sdb read-write, is write-protected
andy@andy-ThinkPad-W530:/media/iRead$ 

Can anybody suggest anything I can try to mount this as writable drive?

I have a very strong feeling that the chip which is storing this data is the following:

ARM STM32F103 RBT6 22oUP _ 93 MLT22950

Hope this helps somebody to help me!


Solution

If processing write commands coming from USB wasn't part of the requirements, it's very unlikely that the device processes write commands.

A read-only USB mass storage device is not a read-write mass storage device with write-protection slapped on top. It's a USB device that doesn't have logic for understanding write requests at all.

After the device is finished and delivered is a little late for deciding

I want to be able to write to the drive so the device 'thinks' it has already scanned x amount of entries.

Of course the flash memory used inside the device is written during its operation. But the way data is stored inside might not look anything like its USB presentation, and the conversion is most likely one-way only.

Since the developer probably did not implement mass storage support from scratch, and the library they used probably has write support, they may be able to easily supply you with firmware modified to be writable and do something with the written data. But without changing the firmware, you get nowhere.



Answered By - Ben Voigt