[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Write protect access on USB port



Kushal Kumaran <kushal.kumaran+debian <at> gmail.com> writes:

> 
> There is a blockdev command with a --setro option in the util-linux
> package.  You can modify your udev rules to run this command when the
> device is plugged in.
> 

Thanks I did not know about this tool. I looked at it and it
accomplishes the read-only set by calling the BLKROSET ioctl (this is
alos done by hdparm -r).

However, this still poses a problem. Check out the following case:

 1. Plug in a USB drive with an ext4 filesystem.

 2. Set the readonly flag using blockdev.

 3. Compute the checksum on this block device.

 4. Mount the ext4 filesytem and then unmount it without doing anything.

 5. Compute the checksum on the block device (checksum does not match).

The ext4 filesystem still updates the journal on the device and changes
the whole checksum.

Thanks,
Amit


Reply to: