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


Click here to return to the 'Create HFS+ and FAT32 partitions on one external drive.' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create HFS+ and FAT32 partitions on one external drive.
Authored by: moritzh on Jan 12, '04 07:43:01PM
I'll share what I've found out because I think it gives you the best possible solution for the problem. Possible that some of you know about this already but from my point of view, my method has not explicitly been described before and I feel it is a good summary of various details spread over many previous posts.

Simply use

diskutil
to partition your extrnal FW drive! No need for a Windoze machine to set this up. Check out the man page for diskutil, it describes pretty well what you need to know and even gives an example which is almost exactly what you want.

The command line tool diskutil pretty much does what the well-known Disk Utility application does (duh...), except it also allows you to mix Apple (HFS+, ...) partitions with MS-DOS partitions on the same drive (you cannot do this with the Disk Utility).

Basically what you want is sth like this:

diskutil partitionDisk device numberOfPartitions MBRFormat <part1Format part1Name part1Size> <part2Format part2Name part2Size>

Replace

<part1Format part1Name part1Size>
with the appropriate details for your HFS+ partition and
<part1Format part1Name part1Size>
with the appropriate details for the MS-DOS partion (or vice versa). Keep in mind that the name for the DOS partition should be uppercase and less than 12 chars, otherwise the partition will not be assigned a name (but be created anyway).

When thinking about the size: You can use abbreviations like

10G
for 10 GByte (see man page). And you don't have to take out a calculator to determine how much space is left for your second partition (given the size of the first one): Simply use the desired size for the first partition and then give a number which exceeds the amount of space left for the second one - then automatically every little byte left will be used for the second partition.

As for the device: Use the procedure described in the original post to find out which device to use (to find out the disk #). Then use sth. like

/dev/disk2
Check out the man page for details.

Although you cannot repartition your boot up disk anyway, I think, be careful here and eject any other disks (such as iPods etc.) before using this command, just in case... As you know, there will be no confirmation question after entering the command and all data on the whole disk (all volumes) will be lost, so make sure you find out the appropriate disk # before typing in anything for fun.

Using the parameter

MBRFormat
specifies that the partition table be written in such a way that Windoze machines can read it.

And here is what you get using the procedure described above:

A partition which will be recognizable on Windoze machines AND Mac machines without problems and a HFS+ partition which will be recognized automatically on the Mac without any problems (no need to manually mount the volume after logging in as described in the original post, the volume will automatically be mounted upon log in and can be unmounted just like any other external volume in the Finder).

HOWEVER, YOU CANNOT BOOT UP YOUR MAC FROM THE HFS+ PARTITION.

As has been said before in previous posts: The way partition tables are stored on Win and Mac systems differs. (At the moment) you cannot have HFS+ and FAT32 (Windows) partitions on the same drive and boot up into the appropriate partition on BOTH systems. See also Pierre Duhem's concerns expressed in a previous post above on this. So if you are REALLY concerned about your data you might want to not use the procedure described and instead stick with ONLY HFS+ or ONLY FAT32. However, I have not experienced any problems with the setup described above (apart from the fact that I cannot boot off the partition which is not so relevant for me anyway and which I don't consider a problem now that i know about it). But can't guarantee total functionality, of course. [Insert "Batteries not included, only valid where not prohibited" and your other favorite legal warnings here.]

As I said, the Finder can perfectly handle the HFS+ volume created in the above manner. It's the Mac's open firmware that does not allow booting with the created HFS+ partition (because it does not like the partition table in MBRFormat). It took me quite a few tries to find out the details on this. For instance, I created a separate HFS+ partition onto which I cloned my whole internal boot up hard drive (via Carbon Copy Cloner). In System Preferences under Startup Disk you can then also select the cloned system for the next start up, BUT IT WILL NOT WORK. Apparrently, the open firmware does not like it (the external FW drive is not detectable at start up (press the [option] key when switching your Mac on to select the start up drive and the FW drive won't show up) but System Preferences does not know this and would let you choose the FW drive for start up although it will not work. On the other hand, by not using the parameter MBRFormat, which you might think would be worth a try, you would end up with a FAT32 (MS-DOS) partition which can be handled perfectly on your Mac but won't be recognized by Windoze which makes the whole thing pretty much pointless.

So Win machines can only handle MBRFormat type partition tables. So whichever way you turn it: Both Mac and Win systems don't really like each other's partition tables (or mixtures thereof) - however, the Mac is a bit more flexible here, as usual. :-) So decide for yourself if the pros or cons of this method overweigh. (I decided to go for it.)

BTW: Am using Mac OS X (10.3.2), if this is of any relevance.

[ Reply to This | # ]

Create HFS+ and FAT32 partitions on one external drive - use diskutil
Authored by: FyKnight on Jan 20, '04 08:31:49PM

That diskutil method rocks! I tried it last night and it worked a charm - first time.

The best bit is it does all the legwork for you, you don't have to fiddle around with mounting and unmounting drives, counting cylinders, allocating partitions or anything like that.

I have now successfully partitioned a 200G firewire drive into HFS+ and FAT32. And the FAT32 partition even mounts fine in linux. Thanks for the hint!

{P^/

btw The man page for diskutil is worth a read too.



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive - use diskutil
Authored by: grantjs on Jan 23, '04 05:22:55PM

Trying to create 3 partitions, I hit a small snag (probably user error)... at first I performed and received the following message:

[diskutil partitionDisk /dev/rdisk4 3 UFS Unix 50G MS-DOS MS-DOS 50G HFS+ MacOS 180G
Could not find disk for /dev/rdisk4.]

So referring to the man pages tried:
[diskutil partitionDisk disk4 3 UFS Unix 50G MS-DOS MS-DOS 50G HFS+ MacOS 180G]

And then no problem, getting back:

[Finished partitioning on disk disk4
/dev/disk4
#: type name size identifier
0: Apple_partition_scheme *232.9 GB disk4
1: Apple_partition_map 31.5 KB disk4s1
2: Apple_Boot 8.5 MB disk4s2
3: Apple_UFS Unix 48.4 GB disk4s3
4: DOS_FAT_32 MS-DOS 50.0 GB disk4s4
5: Apple_HFS MacOS 132.8 GB disk4s6]

Great tip!



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive - use diskutil
Authored by: muze7 on Feb 07, '04 01:33:41PM

Hi,

I am new here but tried something similar and failed.

diskutil partitionDisk disk1 2 MBRFormat HFS+ TEST 30G MS-DOS TEST2 10G

I need the MBRFormat to make the second partition readable under Windows but get the error:

There are too many arguments for the number of partitions specified.

I do not see why though, as I specified two partitions and two series of parameters.
If I get rid of the MBRFormat it works, but I need it!

Any ideas?

Thanks heaps
Bridget



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive - use diskutil
Authored by: moritzh on Mar 05, '04 06:10:06PM
Well, it wouldn't help you now anyway (since you got it working already), but I think your mistake was that you typed
/dev/rdisk4
instead of
/dev/disk4
Small and subtle difference that was pointed out in the original post...

[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive - use diskutil
Authored by: hellomilano on Sep 28, '05 02:20:30PM

Bravo!...worked seamlessly on OSX 10.4 and Windows XP and I have never touched UNIX before. Only addition to above line of code was 'MBRFormat' as noted in original posting. Both booted up without effort on Mac & Win.
Grazie!



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive - use diskutil
Authored by: osxpounder on Sep 29, '05 12:42:46PM

Not working for me. I followed silentaccord's instructions, and everything stops at step 5: "5) Now use fdisk to create the master boot record (MBR) so Windows will recognize the FAT32 partition:
fdisk -e /dev/disk4" [disk4 is the disk I'm working with]

On my machine, fdisk tells me "/dev/disk4 is not a character device or a regular file" and pdisk tells me "can't open file 'disk4' (No such file or directory)". I have fdisk(8), and I'm running OSX 10.3.9.

Can't understand why Disk Utility can tell me that, yes, disk4 is mounted, but it can mount/unmount it, but fdisk swears there's no such disk4. I can use diskutil to mountDisk, too. What do think's wrong? Did I miss something?

---
--
osxpounder



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive - use diskutil
Authored by: osxpounder on Sep 29, '05 02:13:54PM

I worked past my fdisk error: turns out I must specify the disk name differently. Although 'disk4' is what Disk Utility identifies as this disk, I had to use 'fdisk -e /dev/rdisk4' ....

So I managed to use fdisk to make the partitions, one HFS+ and one FAT32, then attached the external drive to a WinXp box. It recognized an unformatted volume, and let me format it [in this case, to 64GB].

Now, on the Mac, the FAT32 volume won't mount. Disk Utility calls it 'disk5s5', even in the graphic interface's left pane. I tried ejecting the disk and remounting. Nope. Tried just ejecting the Mac volume, which mounts every time I attach the disk, but 'disk5s5' still won't mount. Tried ejecting just the Mac volume. Tried using the buttons in DU to mount the disk5s5 volume. Nope and nope.

So I tried using the CLI and diskutil. diskutil reports that disk5s5 is mounted, but ... it doesn't show up in Finder.

If I click "Verify Disk" in DU's GUI with disk5s5 selected [greyed, not mounted, even though diskutil says it's mounted], I get:
Verifying volume "disk5s5"
BAD SUPER BLOCK: MAGIC NUMBER WRONG
** /dev/rdisk5s5 (NO WRITE)

LOOK FOR ALTERNATE SUPERBLOCKS? no


1 volume checked
1 non HFS volume checked

Now I'm really stuck, but I'm going to keep plugging at this.



---
--
osxpounder



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: muze7 on Feb 08, '04 03:23:47AM

Yes, I think the OS is relevant.

I have tried this in OS X 10.2.8 but it seems the kernel does not recognize the MBRFormat command.

From the diskutil man page it is not clear to me when this command was introduced, however

...in case I am doing something wrong, my tried commands in terminal are:

diskutil partitionDisk disk1 2 MBRFormat Hfs+ Test 10G MS-DOS TESTWIN 30G

If I get rid of the MBRFormat it works fine. I also tried to add ' OS9Drivers MBRFormat' rather than MBRFormat by itself but that fails also.

Error is: There are not enough parameters for the amount of partitions you specified
(something to that effect)



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: moritzh on Mar 05, '04 06:36:01PM
You are right, the OS version probably matters indeed. In fact, it appears quite obvious to me now that diskutil must have changed considerably from any previous version to that in 10.3.X because in 10.3.X it now also handles the sparse image files that FileVault uses (whcih is a major enhancement). (The man page for diskutil in 10.3.2 gives 24 Jan 2004 as the date.)

I don't have a machine with anything before 10.3.2 on it to test, but my guess is that full support for

MBRFormat
has indeed been included only in the 10.3 version.

As laid out in previous posts, implementing sth that handles MBRFormat correctly must be quite difficult which could be a reason that it was fully implemented only in 10.3.

BTW, when considering switching to 10.3, make sure you update to the most recent version because the changes made to the FileVault features after the initial release of 10.3 most likey also affected diskutil.

[ Reply to This | # ]

Create HFS+ and FAT32 partitions on one external drive.
Authored by: lyrrad on May 02, '04 02:19:37PM

I initially tried using anonymous' hint, that worked fine, except for the auto-mounting issue. so I searched and found this hint. everything worked, however the initial partition with the FAT32 created some garbage files that took up a good 10G. Puzzled where the files came from. However I quick format on the PC fixed the problem.

Am on 10.3.2



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: Thorir Jonsson on Mar 07, '05 03:07:21AM

I used this to partition an external USB/Firewire 160Gb disk, creating 109Gb HFS+ and MS-DOS 40 Gb partitions:

diskutil partitionDisk device numberOfPartitions MBRFormat <part1Format part1Name part1Size> <part2Format part2Name part2Size>

and there are no problems with either partition, unless machines running MacOS 9.x do not see the HFS+ partition; they only recognise the DOS partition.

---
Thorir J



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: simoncha on Apr 07, '05 06:33:33AM

There is a way to have Dos (FAT32) and Mac (HFS+) partitions on the same BOOTABLE firewire disk.

Warning : Its a hack,but I managed to do that on a Keyplug 80Go Firewire/USB hard disk and it work smoothly : I'm able to boot on it from an iBook G4, and the dos partition is usable on every PC i tried.

The idea is simple. Mac and Dos partition tables use the same area of the disk : the 1st block for DOS, several blocks starting from the 1st for MAC. But they dont use the same bytes on the 1st sector . For more details there is a clear a complete book : "File System Forensic Analysis" from Brian Carrier (see this chapter http://www.aw-bc.com/samplechapter/0321268172.pdf)

So you can make an hybrid 1st sector that Mac recognize as an apple partition table (and YES can boot on any bootable HFS partition) and PC recognize as a DOS partition table.

To do it under MacOs 10.3 :
1) find the device associed with your disk (see above) for me it was /dev/disk1 and unmount it

2) make an apple partition table and format each partition with diskutil :
diskutil partitionDisk disk1 3 \
MS-DOS LaPoche 37276936704B \
MS-DOS Pingouin 12337920000B \
HFS+ SECOURS 30408860160B
this make 2 dos partitions and 1 apple partition. (adapt it to your need, you dont have to express size in bytes, you can use number as 30G as said above)

3) unmount all partitions
4) look at the apple partition table :
diskutil list /dev/disk1

for the example in 2), we get :

/dev/rdisk1 map block size=512
#: type name length base ( size )
1: Apple_partition_map Apple 63 @ 1
2: DOS_FAT_32 DOS_FAT_32_Untitled_2 72806520 @ 64 ( 34.7G)
3: DOS_FAT_32 DOS_FAT_32_Untitled_3 24097504 @ 72806584 ( 11.5G)
4: Apple_Free 0+@ 96904088
5: Apple_HFS Apple_HFS_Untitled_4 59135240 @ 97166232 ( 28.2G)
6: Apple_Free 0+@ 156301472

Device block size=512, Number of Blocks=156301488
DeviceType=0x0, DeviceId=0x0


5) save the partition table (the first blocks) on a regular file (let's call it apple.dd) :
dd if=/dev/rdisk1 of=apple.dd bs=512 count=63

6) create a dos a partition table with fdisk :
fdisk -e
then we can recreate the partitions in a dos table, use EXACTLY the same value in blocks as given in 4)

7) unmount everything again

8) save the dos partition in a regular file :
dd if=/dev/rdisk1 of=dos.dd bs=512 count=1

9) make a mix of the two first blocks in a file call fusion.dd :
cp dos.dd fusion.dd
dd if=apple.dd of=fusion.dd bs=1 count=446

The 446 first bytes of the 1st block is a boot sequence for dos machine, the partition table itself is in the end of the block.

10) write on disk the hacked partition :

dd if=fusion.dd of=/dev/rdisk1 bs=512 count=1 conv=notrunc


11) That's all : you can now wander the world with a disk you can plug in almost every machine (windows, linux, mac) and you can even boot on Mac on any bootable partition !!!

I recommand Carbon Copy Cloner to copy your internal hard disk on such a partition.

Now your turn to help : If someone know hot to force diskutil to use cylinder boundary or make this firewire disk also bootable on PC, please post here or write to macos.x.simoncha@spamgourmet.com



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: silentaccord on Apr 11, '05 07:19:05AM

I tried your procedure and had a few problems.

In step 2), the output I get from "diskutil list /dev/disk1" is nothing like your example. I just ignored it and continued.

In step 6), can you be specific about what commands you used to create the DOS partition table? Since I'm not familiar with fdisk, I used "diskutil partitionDisk" with the MBRFormat argument. Is this acceptable?

In step 10), I can't seem to write back to the partition table:
dd: /dev/rdisk1: Invalid argument
0+1 records in
0+0 records out
0 bytes transferred in 0.002190 secs (0 bytes/sec)



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: dstrelau on Jun 14, '05 06:24:58PM

I don't have a Wintel machine to test it on at the moment, but I think I got this working. The partition table shows up in both pdisk and fdisk and both partitions (I created an HFS+ and a FAT32) show up on my Mac.

I'm guessing that diskutil with MBRFormat should be okay, but I did use fdisk. It's pretty easy if you just use the 'help' and '?' commands.

My disk gave the same 'Invalid Argument' complaint. I found that after fdisking, it had changed from /dev/rdisk1 to /dev/rdisk2 -- strange. Also, even when I put in the correct disk number, I still got 'Invalid Argument,' except this time, the drives remounted and the write light on the drive flashed.



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: vitius on Jan 22, '06 06:07:27PM

the following is my entry in attempting to do what you described. [diskutil partitiondisk disk1 2 MBRFormat Journaled HFS+ GBUM 143G MS-DOS FAT32 GUBP 50G]. the GBUM and GBUP terms are just my volume name choices. i continue to get the following message:

"There do not appear to be enough arguments for the number of partitions you specified."

Any idea why? Your help would be appreciated.



[ Reply to This | # ]
Create HFS+ and FAT32 partitions on one external drive.
Authored by: vikash on Feb 27, '06 12:07:47PM

Try "paritionDisk" with capital D and put "JournaledHFS+" (one word).



[ Reply to This | # ]