13

Sometimes, I have to give my external storage someone else. But, I am worry about files and folders which accidentally deleted, moved, changed etc... Therefore, it is enough that data on the disk can be readable. Writing support not desired.

So,

1) I want to make the partition readonly to prevent deleting and/or writing anything by anyone else.

2) When I take back my disk, I will revert it to readable/writeable mode again.

Any utility or method to achieve these goals?

Edit: I read about some hardware-based solutions and others are valid only at local PC. I am searching for globally valid and software-based solutions.


Solution:

A software-based solution exists for NTFS volumes. I wrote a PowerShell script to automate explained procedure:

PowerShell script to set/clear read-only flag of an NTFS volume

4
  • 3
    I suggest a backup solution of some type, have your files on 2 or more physical drives, then you can do a compare when the drive is returned to you.
    – Moab
    Commented Jan 23, 2011 at 20:03
  • 1
    The answer by Everett from How to mount an NTFS partition read-only in Windows? can be what you want. Commented Mar 3, 2013 at 18:11
  • @AlexeyIvanov Yes, it seems like what I want. I will give it a try... Thanks.
    – mmdemirbas
    Commented Mar 3, 2013 at 20:46
  • @AlexeyIvanov Thank you, it is exactly what I need. Actually, the solution involves with NTFS only, but it is enough in my case. Please, add your comment as an answer, to be marked as accepted answer.
    – mmdemirbas
    Commented Mar 23, 2013 at 11:30

3 Answers 3

7

Everett's solution for NTFS volumes How to mount an NTFS partition read-only in Windows?

  1. Switch off "automount" by running mountvol.exe /N
  2. Connect disk to Windows (do not mount the disk)
  3. Run diskpart
    1. Enter list volume
    2. Enter select volume X
      (where X is the correct volume number from the previous command)
    3. Enter att vol set readonly
    4. Enter detail vol and ensure the read-only bit is set

Now you can mount the volume and it will be read-only.

To re-enable automatic mounting of new volumes, run mountvol.exe /E.

To remove the read-only flag, select the volume in diskpart and in step 3.3 enter att vol clear readonly.

2
  • Does this readonly flag work if the HD is attached to another workstation?
    – mxmissile
    Commented May 18, 2021 at 21:55
  • 1
    @mxmissile I believe it does because it's an attribute written to partition table. On Linux, you can explicitly mount a volume read-only. Anyway, a hardware jumper will give you better protection. Commented May 19, 2021 at 8:16
3

You haven't specified your operating system, so I will assume Windows.

The normal solution is to create a user account, set it as the owner and only one permitted to modify, and giving Everyone the read permission.

This will not work across operating systems (Linux will ignore it), and the administrator on the target machine can always simply take ownership of the disk if he feels like it. So this solution assumes some good will on the part of the recipient.

Otherwise, you will require a hardware solution. Some external disks have write-protect jumpers, such as Seagate. You can find such disks in your local or online store.

2
  • 2
    I haven't specified operating system, because the solution have to be independent from operating system. It also has to be independent from user account concept. Say that, there is a bit in partition table and if you set it, partition will be read-only. For any user, in any OS.. I'm searching for a solution suchlike.
    – mmdemirbas
    Commented Jan 25, 2011 at 10:31
  • 1
    Only solution is hardware. See above.
    – harrymc
    Commented Jan 25, 2011 at 13:39
3

Another solution you can consider is using an encryption wrapper like TrueCrypt. I use this utility to mount my storage wherever I want and you have (password-based) options to decide whether the partition mounted can be modified or read only. Of course it takse one more step and utility to do it, but it's a 2 chicks with one bullet - you also get your info secure.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .