TIP:Lock your Ext HDD using XP or Vista No software required

Viruses, hackers and crackers
Post Reply
DeeVeeDee
Registered User
Posts: 172
Joined: 09 Apr 2010, 15:18

TIP:Lock your Ext HDD using XP or Vista No software required

Post by DeeVeeDee »

If its worth the efford
I wanted to format my 250GB drive to FAT32 and couldn't in windows using the disk manager.
I then got the idea to do this while playing with DISKPART.

Trade offs:
You will have 4 files sitting in the root of your drive.
Only works on NTFS
You can only script lock/unlock it using your own PC, But you can unlock/lock it again manually though.

Will only work on external drives (Does not work on flash drives).

First find out as which volume windows 'mounts' your drive by doing the following.
Attach the drive
Then in a CMD promt type.

Code: Select all

Diskpart
LIST VOLUME
a list of volumes will be given.
Remember the number of your external drive's volume.
In my case its volume 4

Create the following files in the root of your External drive. (Where VOLUME [X] is the volume number of your drive)
Lock.DISKPART & Unlock.DISKPART.

Lock.DISKPART contains the following.

Code: Select all

SELECT VOLUME 4
ATTRIB VOLUME SET READONLY
UnLock.DISKPART contains the following.

Code: Select all

SELECT VOLUME 4
ATTRIB VOLUME CLEAR READONLY
And the following 2 batch files also come in the same path.

Lock.bat and contains the following.

Code: Select all

DISKPART /S Lock.DISKPART
UnLock.bat and contains the following.

Code: Select all

DISKPART /S UnLock.DISKPART
_̴ı̴̴̡̡̡ ̡͌l̡̡̡ ̡͌l̡*̡̡ ̴̡ı̴̴̡ ̡̡͡|̲̲̲͡͡͡ ̲▫̲͡ ̲̲̲͡͡π̲̲͡͡ ̲̲͡▫̲̲͡͡ ̲|̡̡̡ ̡ ̴̡ı̴̡̡ ̡͌l̡̡̡
Post Reply