One of the selling points of ‘LiveCD’ Linux distributions is that they allow you to try out Linux on your computer with out touching anything on your hard drive. Sometimes, however, you you want to do exactly that. While playing with a Ubuntu LiveCD on my Powerbook, I decided that I wanted to do exactly that. These are the steps that I followed, after some Googling led me to this thread on the Ubuntu forums.
Please Note: By default, the Ubuntu LiveCD will not touch your hard drive. This is for your safety. The steps below allow you read and write to your hard drive’s OS X partition while running Ubuntu from the Live CD. If this makes you in any way nervous, don’t do it. If you don’t know why it should make you nervous, don’t do it. I make no warranties. You could lose all your data, your job, or your hair. In fact, you should just stop reading now, and go watch television.
Still with me? Okay. You were warned. From the Ubuntu Applications menu, choose Utilities, and therein choose Terminal (aside from the use of a menu instead of Finder, it’s just like OS X). Once in terminal, you need to create a ‘mount point’, which is just an empty directory where you want to be able to access your OS X partition. The traditional place for this is in
sudo mkdir /mnt/macosx
Just as in OS X,
sudo will make your command run as root. When running from the LiveCD, you will not be prompted for a password, so make sure you’re sure about your commands before pressing Return.
Next, we need to find out what hard drive partition your OS X data is on. OS X normally creates a number of small partitions for its own use. To check your drive, you can use
parted. Another Dire Warning:
parted‘s raison-d’etre is viewing and changing disk partitions. It can and will destroy your harddrive. If you’re nervous, don’t do it. Here’s my entire
ubuntu@ubuntu:/usr$ sudo /sbin/parted GNU Parted 1.6.20 with HFS shrink patch 16 Copyright (C) 1998 - 2004 Free Software Foundation, Inc. This program is free software, covered by the GNU General Public License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Using /dev/hda (parted) print Disk geometry for /dev/hda: 0.000-38154.375 megabytes Disk label type: mac Minor Start End Filesystem Name Flags 1 0.000 0.031 Apple 2 0.031 0.058 Macintosh 3 0.059 0.085 Macintosh 4 0.086 0.113 Macintosh 5 0.113 0.140 Macintosh 6 0.141 0.390 Macintosh 7 0.391 0.640 Macintosh 8 0.641 0.890 Patch Partition 10 128.891 33050.109 hfs+ Apple_HFS_Untitled_2 (parted) quit Information: Don't forget to update /etc/fstab, if necessary.
First, I invoked it with
sudo /sbin/parted. Under Ubuntu Live, only root can access /dev/hda, which is your harddrive. Note the line
Using /dev/hda. If you see something else, you can try
select /dev/hda, but you probably forgot the sudo, or else you have a system which is different enough from mine that you should just type
quit now and seek another source of information.
At the first prompt (
(parted)), I typed
quit and return to the bash prompt.
Now it’s time to mount the drive. Here’s the command I used, using the mount point I created earlier and the partition number I learned from
sudo mount -t hfsplus /dev/hda10 /mnt/macosx
If you get no ouput, success. Otherwise, something went wrong, and you should quit now or seek other counsel. Assuming it worked, you should be able to access your OS X partition thusly:
Your OS X partition is now mounted under
/mnt/macosx. So for example, my OS X home directory, which is normally
/Users/jclark, is now
/mnt/macosx/Users/jclark. Should you want to write any of the directories in the mounted partition (don’t do it!), you’ll need to run your commands with
Final word: I don’t know for sure how Ubuntu will unmount the partition when I shut it down. It should be fine, but an ounce of prevention is worth a pound of reformatting. To unmount your partition, use
umount (cd out of the /mnt/macosx directory tree first):
cd sudo umount /dev/hda10
You can double check your work by running
mount with no arguments to see a list of all mounted partitions. After the umount,
/dev/hda10 (or your equivalent) should not be listed.
Both comments and pings are currently closed.