Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Mount read-only disk images as read-write images UNIX
I frequently use VirtualPC for my Oxford English Dictionary (which I conveniently save after the CD authentication step). Unfortunately, it takes about 4 gigabytes of my PowerBook's disk space. Since VirtualPC requires a writable disk, I could never use a heavily compressed disk image.

I've recently found that OS X now supports mounting compressed and other read-only types as read-write with the use of a shadow file. For example:
% hdiutil attach oed.dmg -shadow /tmp/oed.shadow -noverify
Not only does this save me about 2 gigabytes of drive space, but it lets me avoid worrying about cleanly saving state from VirtualPC, since I can just ditch the shadow file, and go back to my clean version instantly.
    •    
  • Currently 4.20 / 5
  You rated: 5 / 5 (5 votes cast)
 
[18,928 views]  

Mount read-only disk images as read-write images | 8 comments | Create New Account
Click here to return to the 'Mount read-only disk images as read-write images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Awesome
Authored by: lullabud on May 19, '05 01:22:39PM

I was recently thinking of taking another stab at VPC once I get my new system and this will *really* help out! Also, I'm going to have to experiement with burning CD images that have a shadow file since this technique could give you the ability to change .iso files without having to worry about messing up hidden files and extra .iso or joliet attributes during a conversion to UDRW and back. Sweet tip!



[ Reply to This | # ]
Shadow not supported in burn :(
Authored by: lullabud on May 19, '05 06:44:47PM

I just tried to burn a .iso image using a shadow file and all I get back is a bus error. Too bad.



[ Reply to This | # ]
Mount read-only disk images as read-write images
Authored by: Oneota on May 19, '05 04:08:54PM

Shadow files have been supported since Jaguar. We used to use them to host the Classic system folder on a read-only disk image for our lab Macs.



[ Reply to This | # ]
OED access
Authored by: earthsaver on May 19, '05 04:21:31PM

Or, you could get Tiger and have easy access to OED and OET, built-in.

---
- Ben Rosenthal
Q16 1.25 - Tiger



[ Reply to This | # ]
OED access
Authored by: rsfinn on May 19, '05 05:30:10PM
No, Tiger has the Oxford American Dictionary and Thesaurus, not the Oxford English Dictionary. Still very very useful, but not (as any OED owner would agree) the same thing.

[ Reply to This | # ]
OED access
Authored by: stephenj on May 20, '05 09:31:22AM

Though it does look like apple has provided a way to add more dictionaries:

/Library/Dictionaries/
Oxford American Writers Thesaurus.dict
New Oxford American Dictionary.dict

So the question is where do you get others...

---
if by chance or circumstance...



[ Reply to This | # ]
Mount read-only disk images as read-write images
Authored by: derrickbass on May 19, '05 05:40:24PM
One thing about shadow files that's pretty annoying... As soon as you read any portion of the disk image, that bit is written out to the shadow file, even if you don't change it. So you can end up with a really gigantic shadow file (even bigger than the original disk image, because that can be compressed, while the shadow file cannot), even if your never write to the disk image at all.

I think the reason is that this system was designed for network booting (the original disk image would be on the server and the shadow file on the local computer), so it makes sense to cache anything that is read over the network to the local drive. But it would be nice to be able to turn that off.

[ Reply to This | # ]

this trick helps archive management on dumb file servers
Authored by: rose00 on Dec 12, '05 12:15:45PM
This is just the fix I need.

I archive old files in disk images on a CIFS network disk. This works pretty well, despite the weaknesses of CIFS, since the Apple file system details are inside the disk images. But my file server (low-end Buffalo) does not allow me to lock the files.

So one thing that has not worked well is the fact that whenever I open an archived disk image, Finder writes back pages to the network disk, as it makes trivial updates to .DS_Store files in the disk image. (Even worse, Microsoft Word likes to scribble on folders even if you are just looking.) Making random updates is not a good way to treat one's archives!

With the shadow-file mounting technique, when I browse archived images, the silly updates are posted to /tmp, and can be discarded properly. As a side benefit, there are fewer handshakes with the file server, so browsing and searching are faster.

I made a Finder plugin in Automator to put this mounting technique on the right button everywhere. (I only wish there were a way to get this behavior from a plain double click.) Here is the relevant shell code for the Automator action:


exec >> /tmp/mrolog.txt 2>&1
echo + date; date
for f in "$@"
do
	sf=$(basename "$f")
	[ -f /tmp/"$sf".shadow ] && sf=$sf-$$
	echo + 
	hdiutil attach "$f" -shadow /tmp/"$sf".shadow -noverify
	hdiutil attach "$f" -shadow /tmp/"$sf".shadow -noverify
done


[ Reply to This | # ]