HOWTO: Mount an OS X Hard Drive from a Ubuntu LiveCD
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 /mnt
:
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 parted
session:
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 print
which printed the partition table below. As you can see, my OS X partion is number 10. So I type 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 parted
:
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:
cd /mnt/macosx
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 sudo
.
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.
alternative way of viewing the partition<br/>
Instead of using “sudo /sbin/parted”, I used “mac-fdisk” : mac-fdisk -l /dev/hda
Awesome. I just upgraded to a Powerbook from a Toshiba laptop and was unable to access my external drive that has ext3. Something about Tiger changed so that the ext2/3 driver no longer worked. I had the idea today to use the Ubuntu PPC LiveCD to access the ext3 and then use Linux’s HFS+ support to write everything to the Mac’s drive. I found your site to get the correct OS X file system type and then it worked great, thanks! Luckily, I had all my dar backups on that drive too so when the Toshiba’s hard drive crashed I didn’t lose everything. The write support works well too and you have to love that speedy USB2 connection.
I just wanted to send out a major THANK YOU for this post. I had some serious problems with the file system on my new macbook pro and I was able to use a Ubuntu live CD, along with an external WD My Book drive to copy off all of my files before I did an Erase and Install on the Macbook Pro. Thank you, thank you, thank you! I suppose I should thank google too, for helping me find your page.
[…] A couple of days ago, I got one that almost slipped past me. The following comment was left on this post about mounting an OS X partition from Ubuntu: […]
how odd. I did a google search expecting to find an answer in the ubuntu forums on how to do it from an install and I was ready to adapt the instrucctions to work on a mac in LiveCD mode.
btw, i googled ‘mount hard drive ubuntu’
Great CLI! It worked perfectly as shown above. Ubuntu now accesses the Mac partition. Thanks!
thanks so much for the info, really helped after our G4 died…
bit more which might help someone else out. i found which drive i needed to mount by running:
sudo ls -alh /dev | grep hd
(this does a listing of the contents of /dev -alh means all files (a), one file per line (l) and human-readable output – e.g. MB, GB (h). the pipe ‘|’ symbols directs the output of the listing to grep which is a filter, ‘grep hd’ filters the results for lines containing ‘hd’ which is *nix systems are ATA hard disks)
which showed that my OSX drive was hdc as i contained hdc, hdc1, hdc2, hdc3, hdc4 and hdc5.
then i mounted hdc3 which was the largest partition as above which worked fine.
i have also added it to my fstab so it mounts when the machine starts, not everyone will want to do this but it saves re-mounting each time:
sudo nano /etc/fstab
which will open an editor. simply add a new line at the bottom of the file (actually, position shouldn’t really matter):
/dev/hdc3 /mnt/macosx hfsplus defaults,noatime 0 0
now the osx disc is mounted automatically. by the way, kubuntu seems to unmount the drive just fine…i forgot and tried the risky way but it was no problem.
thanks again…you’re a life saver…or data saver at least…
this works great. however, how do I delete my Mac OSX drive? Whenever I try to wipe files from it, I get “cannot be deleted because it is on a read-only disk”.
Thanks for all our help though!
Unfortunately you can’t write/remove on mounted Mac OS X partition.
use gparted included with the CD.
I am switching from Mac to Linux (long story!) and I backed all my wife’s files on the Mac to a DVD using the Mac’s Disk Utility. When I found I couldn’t mount the thing once I had formatted the drive, installed Kubuntu, I started to think how angry my wife would be, and how long I would have to sleep in the doghouse after loosing all her files. Few quick google searches pointed me to this website. I was able to mount the HFS+ cdrom and all is good. Thanks!
[…] Like most bloggers, I use comment moderation to help prevent spam (along with Akismet, which does alot of the heavy lifting). I’m also using the option “Comment author must have a previously approved comment”. This option allows comments to bypass moderation if the commenter has a previously approved comment. In general, I prefer this approach – there are certainly some of you who comment here from time to time, and I’d rather your comments go live straightaway rather than wait on me to moderate. On the other hand, I’ve got about 10 comments right now awaiting moderation, because they aren’t really spam, but I don’t want to give the commenter a free pass to comment in the future. For example, my Ubuntu drive mounting tutorial draws a lot of thank-you comments, and many of them are very brief- they could be legit, or they could be someone trying to get me to approve one comment, so they can spam freely. […]
That’s some interesting near-paranoia there (in your linkback summary about comment moderation). As a fellow WP user, Akismet does just wonderful for me and I set the moderation threshhold to sandbox any comments with links in it. Other than that, my blog is open to reader comments.
Now! My real reason in writing was to chime-in and thank you for information on how to get Ubuntu to read HFS+. I’ve got an external drive in HFS+ which I’d like to attach to my Ubuntu installation… and your guide should allow me to get ‘er done.
Yeehaw.
While this works nicely for me for reading (thanks!), it does mount the device read-only for me.
The best mounting tutorial on the web.. Thanks
Thanks for the site. I was able to mount the drive, but I cannot access specific folders under my user account on the Mac(e.g. Username/desktop). Is there a way to mount the drive as a specific user or provide a username and password?
Thanks!
For those who cant access their files once the drive is mounted type the following command, sudo su. This will give you admin access and no password is required.
[…] Do you have another Mac or access to another Mac? Boot into Firewire Target Disk Mode on your eMac, connect to another Mac, and start deleting files. You could also try booting off a Linux LiveCD (Ubuntu is my personal choice), backing up your stuff to your external drive, and reinstalling. If you’re feeling particularly adventurous, you can try this guy’s tutorial on how to use a LiveCD to have write access to an HFS+ partition (Mac-formatted). […]
thanks man. I mount a FW400 with 2 FAT32s and a HFS+ sudo mount /sda1, /sda2 and mount -t hfsplus /dev/sda3 /mnt/journaled, thanks for the syntax, now if i can just get fstab to do that all for me
I just wanted to add my own to the long list of Thank Yous. I had an old PowerPC lying around, but could not use it because someone else had set up a single user account and forgotten the password. I used this tutorial and System-Recovery-CD PPC 0.2.0 to delete the Multiple-User Prefs file in the Preferences folder within the System Folder, and everything is great now. Thanks!
Thank you SO much for this mount information. I hadn’t found it anywhere else, and I hadn’t been aware of the filetype to enter after the -t … amazing what a difference using the correct file system makes when attempting to mount, eh? (grin)
Thanks again – you’ve made my day go SO much better!
Happy Keystrokes and Footsteps!!
Thanks for the info! Trying to mount my borked hfsplus fs from the 6.02 alternate ppc cd (only one I had easily accessible) and for some reason mount needed ‘hfsplus’ as the filesystem type as opposed to ‘hfs+’ (which mac-fdisk shows, for some dumb reason).
Thanks for the friendly reminder of the filesystm name!
-Nick
I can’t thank you enough for this blog post! My MacBook hard drive went kablooey after upgrading to 10.5.6, and while I’ve got JungleDisk backing up my system every 15 minutes, it just so happened I was in the midst of a big brainstorming session when my HD crashed, so I was eager to get back my last 10 minutes if possible. Your method worked flawlessly, and I’ve got all my files safely on a USB stick. You rock!
[…] a MAC OS X disk (HPFS) on ubuntu As usual, the internet has an answer to everything – http://jclark.org/weblog/2005/05/24/ubuntumount/. There was one thing I did differently to get going so I figured I’d note it here, in case […]
Thanks very much for your help. I have booted Ubuntu 6.06 PPC and is working as expected. http://releases.ubuntu.com/6.06/
also works in Mandriva. thanks
Another thank you ! Very concise and made my day :)
I’m running a MacBook Pro with a MacOSX Snow Leopard partition and a Windows partition. My MacOSX partition will not boot, so I booted ubuntu to try to get my data before wiping and reinstalling the operating system. Gparted in ubuntu sees my MacOS partition but says that it is not mounted and “Warning: unable to read the contents of this filesystem! Because of this some operations may be unavilable.” I used the code here to mount my osx in terminal (I now see: ubuntu@ubuntu: /mnt/macosx$), but I am completely new at using terminal – what do i do from here to actually reach my files? also, I’ve read on other websites suggestions to use gksudo nautilus – should I do that?
Thank you very much for any and all help!
Actually I apologize – I used nautilus and found my files! Now I just have to deal with the permissions issue but there are many articles on that. You can delete both these comments. Thanks!
[…] Shared jclark.org – HOWTO: Mount an OS X Hard Drive from a Ubuntu LiveCD. […]
I cant mount a partition bigger than 2tb with ubuntu. is there any method to do it?
@:~$ sudo mount -t hfsplus /dev/sdb2 /mnt/drobo mount: wrong fs type, bad option, bad superblock on /dev/sdb2, missing codepage or helper program, or other error Manchmal liefert das Syslog wertvolle Informationen – versuchen Sie dmesg | tail oder so
@:~$ dmesg | tail [ 120.631136] hfs: volumes larger than 2TB are not supported yet [ 120.631144] hfs: unable to find HFS+ superblock [ 1086.286325] xhcihcd 0000:02:00.0: WARN: Stalled endpoint [ 1086.286941] xhcihcd 0000:02:00.0: WARN: Stalled endpoint [ 1098.290149] endrequest: I/O error, dev fd0, sector 0 [ 1110.370683] endrequest: I/O error, dev fd0, sector 0 [ 1306.531587] xhcihcd 0000:02:00.0: WARN: Stalled endpoint [ 1306.537216] xhcihcd 0000:02:00.0: WARN: Stalled endpoint [ 1347.216597] hfs: volumes larger than 2TB are not supported yet [ 1347.216605] hfs: unable to find HFS+ superblock
Thanks for this, worked perfectly. Now if only I could access the password protected bits from that HDD.
[…] dtube, I'm guessing that you haven't messed with an Acer Aspire, hardware-wise. They're not the easiest machine to get at the drive on, at least that's the case with the little 9 inchers. They require just about complete bottom end disassembly. Try this Bob. Good luck! jclark.org – HOWTO: Mount an OS X Hard Drive from a Ubuntu LiveCD […]
[…] Here is a good tutorial show you how to Mount an OS X Hard Drive from a Ubuntu LiveCD: 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. […]