Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lock a partition to prevent writing?




On Mar 14, 2007, at 10:24:48, Josh Whitver wrote:

I'm in the midst of a HDD project that requires one of the HFS partition to be locked to prevent writing, I've googled this and came up empty, anyone know of a utility that allows this?

Locking the mounted volume from the finder isn't an option since the tests are using the IOKit to see that the particular partition is actually read-only.

-- Dale

$ man mount

More specifically, something like this:

$ sudo mount -t hfs -f -r /dev/<deviceID> <mountpoint>

If this is still too high-level, you're going to have to play IOKit's game...

M.

Unfortunately to execute that command (which is the same as locking the drive in the finder) you have to be booted into OSX to perform.


Unfortunately the test is performed during the boot process and the system wont boot up if the particular partition is writable.

I believe that partition locking is done in the partition map by setting a flag and I'd image the drive and hex edit it to change the byte if I know what I was looking for.


You might try tweaking your /etc/fstab by adding a line like this (or creating a new file containing a line like this):
UUID=[UUID of volume] none hfs ro


I'm not sure about the "none" in the second column - we use a setup like this to prevent XServe RAID LUNs from mounting on our servers (since LUN masking was too unreliable for awhile there), so you may want to investigate this a bit to make sure that you don't need some other value in place of "none." However, that "ro" in the last column should force the volume to be mounted in a read-only state. You can get the UUID by right-clicking on the volume name in Disk Utility and choosing "Information" - it's the "Universal Unique Identifier". Don't include the "[" "]" characters.

This doesn't make the partition read-only, it only prevents that machine from writing to the drive after it has reached the desktop which can't occur if the partition in question isn't locked and the UUID will not be constant as the drive is moved from machine to machine via a firewire or USB cable.


--
Josh Whitver

-- Dale


_______________________________________________ Do not post admin requests to the list. They will be ignored. Macos-x-server mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/macos-x-server/email@hidden

This email sent to email@hidden
References: 
 >lock a partition to prevent writing? (From: webmaster <email@hidden>)
 >Re: lock a partition to prevent writing? (From: Mark Glossop <email@hidden>)
 >Re: lock a partition to prevent writing? (From: webmaster <email@hidden>)
 >Re: lock a partition to prevent writing? (From: Josh Whitver <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.