You are not logged in.

#1 2013-08-25 23:39:44

ugluk
Member
Registered: 2012-12-07
Posts: 11

apple/mac partition types support

I am trying to mount an Apple partition created from a virtual machine and exported via nbd:

$ parted /dev/nbd0
WARNING: You are not superuser.  Watch out for permissions.
GNU Parted 3.1
Using /dev/nbd0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Model: Unknown (unknown)
Disk /dev/nbd0: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: mac
Disk Flags:

Number  Start   End     Size    File system  Name      Flags
1      512B    32.8kB  32.3kB               Apple
2      32.8kB  10.2GB  10.2GB  ext4         untitled
4      10.2GB  10.7GB  508MB                swap      swap

(parted)

But fdisk says:

$ fdisk /dev/nbd0
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xcf879138.

How can I mount the ext4 partition shown by parted? I've tried to load the hfs and hfsplus modules to no effect. Please help!

Offline

#2 2013-08-25 23:45:11

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: apple/mac partition types support


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#3 2013-08-25 23:50:14

ugluk
Member
Registered: 2012-12-07
Posts: 11

Re: apple/mac partition types support

So I get fsck and mkfs, how is that supposed to help?

hfsprogs /usr/bin/fsck.hfsplus
hfsprogs /usr/bin/mkfs.hfsplus

Offline

#4 2013-08-25 23:53:16

ugluk
Member
Registered: 2012-12-07
Posts: 11

Re: apple/mac partition types support

Also, hmount from hfsutils does not help

hmount /dev/nbd0 2
/dev/nbd0: contains 0 HFS partitions
hmount: /dev/nbd0: partition not found (Invalid argument)

Offline

#5 2013-08-26 00:05:35

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: apple/mac partition types support

You shouldn't need anything extra just to mount it but hfsprogs is useful if you want to mount at boot, say, because the system will look for a fsck tool. Though you can disable this.

hfsutils will not work with hfs+ partitions.

OK. I just reread your first post. Is this an ext4 partition as gparted claims? In that case, you should be able to mount it in the usual way and nothing fancy should be required at all. What have you tried?


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#6 2013-08-26 00:08:51

ugluk
Member
Registered: 2012-12-07
Posts: 11

Re: apple/mac partition types support

The thing is, that fdisk /dev/ndb0 should show me the 3 partitions, that gparted can recognize. If I cannot get fdisk to recognize those 3 partitions mounting the ext4 partition won't work. In my opinion the problem lies in a missing module for apple partition support. I would hate to have to compile a custom kernel though, that's why I ask here. Can I somehow download the missing module?

Last edited by ugluk (2013-08-26 00:09:11)

Offline

#7 2013-08-26 00:14:28

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: apple/mac partition types support

Are you certain fdisk can read the relevant partition table?

In fact, do you know what sort of partition table it is? I'm not sure what parted means by "mac". Does that mean Apple Partition Map? Or a newer type? Or something else?

gdisk can recognise APM but I can't find mention of that in fdisk's manual page.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#8 2013-08-26 00:19:28

ugluk
Member
Registered: 2012-12-07
Posts: 11

Re: apple/mac partition types support

It is a partition table type that is used on PowerPC machines. I don't know how it is called. I suspect fdisk is using the kernel to query partition table info, while gparted reads the block device /dev/nbd0 directly and has built-in functionality.

Offline

#9 2013-08-26 00:25:16

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: apple/mac partition types support

OK. That's an Apple Partition Map. Or should be. Intel Macs use GPT but PPC Macs need APM to boot.

gdisk should be able to recognise that it is APM but not to manipulate the data.

Linux can definitely use APM - there shouldn't be anything odd about it that I can think of. You can install Linux on a disk with this type of partition map and it works fine. (I set a PPC mac up to dual boot OS X and GNU/Linux and it has to be APM for the former.)


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#10 2013-08-26 00:32:59

ugluk
Member
Registered: 2012-12-07
Posts: 11

Re: apple/mac partition types support

Sure it works, if it has the support compiled into the kernel, or as a module. I am on x86_64 arch linux and am trying to mount this mac partition, that's why I suspect it does not work.

Offline

#11 2013-08-26 00:54:13

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: apple/mac partition types support

If you are using the stock kernel, it supports it, I think. I am pretty sure that

CONFIG_MAC_PARTITION=y

is referring to APM.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#12 2013-08-26 12:55:47

ugluk
Member
Registered: 2012-12-07
Posts: 11

Re: apple/mac partition types support

This was the solution:

# parted /dev/nbd0
GNU Parted 3.1
Using /dev/nbd0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Model: Unknown (unknown)
Disk /dev/nbd0: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: mac
Disk Flags:

Number  Start   End     Size    File system  Name      Flags
1      512B    32.8kB  32.3kB               Apple
2      32.8kB  10.2GB  10.2GB  ext4         untitled
3      10.2GB  10.7GB  508MB                swap      swap

(parted) unit B                                                           
(parted) p
Model: Unknown (unknown)
Disk /dev/nbd0: 10737418240B
Sector size (logical/physical): 512B/512B
Partition Table: mac
Disk Flags:

Number  Start         End           Size          File system  Name      Flags
1      512B          32767B        32256B                     Apple
2      32768B        10229033471B  10229000704B  ext4         untitled
3      10229033472B  10737417727B  508384256B                 swap      swap
                                                                                                                                                                     
(parted) q                                                                                                                                                           
# mount -o loop,offset=32768 /dev/nbd0 /mnt

Offline

#13 2013-08-26 15:15:12

srs5694
Member
From: Woonsocket, RI
Registered: 2012-11-06
Posts: 719
Website

Re: apple/mac partition types support

You may have solved this problem to your satisfaction, but I have two additional suggestions:

  • There's a command or method to cause the kernel to create partition device files. Unfortunately, I don't recall the details offhand. I vaguely recall setting this up as a udev rule once, so it may be something that's built into udev; or it could be I launched an external command using a udev rule. Either way, try doing a Web search on "Linux create partition device files" or something similar. In fact, it's conceivable that these files already exist; you can search for /dev/nbd0*; if there are additional files (like /dev/nbd01, /dev/nbd02, and /dev/nbd03), they refer to the partitions on the device.

  • Export only the partition you want. I don't know what software you're using on the Mac side, but if it's even remotely flexible, it should provide a way for you to export partition 2 on the target disk without exporting the whole disk. This is likely to be the simplest solution, assuming the software on the Mac side supports this.

Offline

Board footer

Powered by FluxBB