Wednesday 20 June 2018

partitioning - How to make a partition on external storage read-only? And revert to normal?


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



Answer



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.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...