Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I keep an external drive on my desk at work that I used as an off-site (ie not at home) backup. Because it could easily get taken I have a partition on it encrypted with TrueCrypt. I've got a script to mount this encrypted partition then do a backup via rsync then un-mount. It looks like:

truecypt /dev/rdisk1s2  /Volumes/untitled
rsync -myRsyncOptions /Users/me /Volumes/untitled/me
truecypt -d   /Volumes/untitled

It works well, so long as my drive is seen as /dev/rdisk1s2. If not the script breaks. The trouble is that I need to point Truecrypt to the correct device file in order to mount the volume correctly. Sometimes the device file will change. Once the first line in the script works the rest of the script works.

Is there anyway I can use UUID or otherwise to ensure that my encrypted partition always gets the same device file attached to it so Truecrypt can mount it successfully? I've seen a few examples of using UUIDs in the /etc/fstab file but I don't think they apply in this case. Thanks!

share|improve this question

2 Answers 2

Here's a quick and dirty guide to specify the mount point based on the UUID. It works in Linux and since OS X respects fstab, it should work there too: http://www.cyberciti.biz/faq/linux-finding-using-uuids-to-update-fstab/

Note: You might have to modify it a bit as some of the entries specified are not used in OS X. Give it a shot.

Additionally, I'm wondering if you could just change up your script to pull the device name instead of the mount point, that is, use the device name (e.g., /Volumes/YourDrive instead of /dev/rdisk1s2) as that never changes (unless you rename the drive).

share|improve this answer
    
+1 for the last paragraph –  Mark Sep 4 '11 at 8:42
    
Your answer is wrong, but that's because my question is not written clearly enough. I'll edit. –  arandomlypickedname Sep 4 '11 at 9:08
    
I hope it's clearer now that I need to specify the device file based on the UUID, not the mount point –  arandomlypickedname Sep 4 '11 at 9:45

It would be better to build up a filter and use diskutil list to "find" your drive no matter where it gets mounted. If you edit the question to show what the desired volume looks like to the OS before the first truecrypt command, perhaps we can assist with some ideas to get the appropriate /dev/rdiskXs2 value dynamically using diskutil

share|improve this answer
    
Thanks for your comment. I'm not sure exactly what you mean by "show what the desired volume looks like to the OS before the first truecrypt command". Would I use diskutil for that? –  arandomlypickedname Sep 4 '11 at 12:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.