pali / udftools

Linux tools for UDF filesystems and DVD/CD-R(W) drives
GNU General Public License v2.0
108 stars 30 forks source link

Read-only clarification #60

Open CyprusSocialite opened 1 year ago

CyprusSocialite commented 1 year ago

Hi!

This is not technically an 'Issue' but there really is nowhere else for me to ask.

I am struggling to understand how the --read-only option is supposed to work. It seems that using it will result in a new, empty and also immediately unwritable filesystem. What's the use, then?

Personally I am setting up some UDF partitions on my usb, and I would like to protect some of them from writing, but only after I've put some files there that can be read. Is there a way to accomplish this?

Thank you

pali commented 1 year ago

The purpose of mkudffs --read-only is to set into UDF filesystem "metadata" some flags which treat filesystem as readonly. I agree that this option as alone is not very useful. If there would be mkudffs option to put files/dirs during generating filesystem then it makes more sense (I was planning to implement this in past but I have not done it yet). Or if there is a tool which can set or clear those flags. Or if there was a tool which can put files into such filesystem and ignoring read-only flags. IIRC currently there no such tool is written yet.

CyprusSocialite commented 1 year ago

Just a guess, but doesn't udflabel edit metadata of existing UDF filesystems? So maybe the flag could be added/edited in a similar way...

pali commented 1 year ago

You are right. I was planning to write some udftune tool (based on the the udflabel code) which can set different flags like this but I have not done it yet.

pali commented 1 year ago

If you are interested to write such tool, feel free to do it.

jtru commented 1 year ago

I am in need of this feature, and tried to scratch my own itch.

The most logical place (that already exists :)) for such a feature to implement is udflabel (since it modifies the on-disc structure of existing UDF data) - so I did the least amount of work to make that support setting a UDF device/file system "read-only" after the fact in https://github.com/pali/udftools/pull/62

I hope you find this contribution useful, and will consider merging it :) If there's any changes you would suggest or require to do so, please let me know.