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

Create a new disk partition without partitioning System
This hint will let you create a new disk partition without destroying your data, or actually partitioning. What do I mean? I think this warrants some explanation: Instead of partitioning your hard disk to divide the space between two different volumes, you will make a disk image that is invisible. This disk image will be automatically mounted when the system boots, and it will look and feel exactly like a hard disk partition. The only difference that should be noticeable is that you cannot boot from it.

Hopefully most of you will find this one easy. It does require a little Terminal usage, but I'll step you through it.

[robg adds: I haven't tested this tip. If you do so, be careful with it, especially if you choose to later remove it -- any files not backed up from the 'partitions' will be lost when you delete them. I don't think this will work as described in Tiger, due to changes in handling diskmounting, but I'm not positive.]

Installation
  1. Open Disk Utility in your Utilities folder (inside the Applications folder).
  2. Without having any drives or volumes selected, click on the 'New Image' button. This will be your partition; choose a size accordingly. (I recommend read/write disk image, but sparse should also work)
  3. Save it as 'Partition' and save it to your Desktop
  4. Open Terminal in your Utilities folder, and type the following commands (you will be prompted for for an admin password). You can copy and paste things into the Terminal -- this will make things immensely easier.
  5. sudo mv ~/Desktop/Partition.dmg /.Partition1.dmg
    This moves the partition file you created off your desktop and makes it a hidden file. If you wish to make additional partitions, use Partition2.dmg then Partition3.dmg and so on.
  6. sudo mkdir /Library/Hooks; sudo echo "#! /bin/bash" > /Library/Hooks/MountFakePartition
    This will make a script that can be run before login. Skip this step if you have done this at least once already.
  7. sudo chmod +x /Library/Hooks/MountFakePartition
    This will make the script executable. Skip this step if you have done this at least once already.
  8. sudo defaults write /Library/Preferences/SystemConfiguration/autodiskmount AutomountDisksWithoutUserLogin -bool true
    Enable disks to be mounted without user intervention. Skip this step if you have done this at least once already.
  9. sudo /usr/bin/defaults write /Library/Preferences/com.apple.loginwindow LoginHook /Library/Hooks/MountFakePartition
    Have the script run right before login. Skip this step if you have done this at least once already.
  10. sudo echo "hdiutil mount /.Partition1.dmg" >>  /Library/Hooks/MountFakePartition
    This will add the mounting of the partition to the script. Change /.Partition1.dmg to whatever is necessary if this is not your first time to do this.
That's it; restart your machine, and you will have a 'partitioned' (not really) hard disk!

What's the deal? Okay, Juz10mac, you said this would look and feel like a real hard disk partition, but it doesn't look like one. The solution to this is easy, and optional:
  1. Control-click on your hard disk and choose Get Info. Click on the icon in the Get Info window then do an Edit -> Copy.
  2. Control-click on your new partition and choose Get Info. Click on the icon in the get info window then do an Edit -> Paste.
To uninstall: Warning! this will delete your created 'partitions.'

Open Terminal in your Utilities folder, and type these commands (you will be prompted for for an admin password):
$ sudo rm -f /.Partition*
$ sudo rm -f /Library/Hooks/MountFakePartion
Enjoy!
    •    
  • Currently 2.80 / 5
  You rated: 4 / 5 (5 votes cast)
 
[17,306 views]  

Create a new disk partition without partitioning | 9 comments | Create New Account
Click here to return to the 'Create a new disk partition without partitioning' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a new disk partition without partitioning
Authored by: Arakageeta on May 09, '05 04:19:19PM

Though this is certainly useful (image encryption is a big plus), you might find some issues in file fragmentation.

The image file is like any other file and is subject to fragmentation. As you perform block access on the image volume you might find some performance hits as you jump to different sectors of the physical disk.



[ Reply to This | # ]
Create a new disk partition without partitioning
Authored by: genericuser on May 09, '05 06:36:33PM

I've heard that if one uses photoshop, final cut, etc one should have the app on a partition & the files on another. Would this be something to do - like put the program on the virtual partition?
I'm on a laptop. space & speed are important but not always accessable... Thanks!



[ Reply to This | # ]
space or speed
Authored by: juz10mac on May 09, '05 07:17:36PM

My hint won't gain you any space or speed. The main idea is, if you want to keep things separate for organization, this would be the way to do it. If you want to keep all of your video's or pictures on a media volume, for simplicity's sake, you could use this. You could also set ignored permissions on your new 'partition' so multiple users can all use and work with the same media in their projects. The only case I can think of, where putting the application separate from the files is if if you had two separate physical disks (i.e. two hard drives).



[ Reply to This | # ]
Create a new disk partition without partitioning
Authored by: tiedyed on May 09, '05 10:18:42PM

juz10mac is correct, but let me expand on that. Whether or not you have multiple physical partitions or simply a mounted image file, the disk has to continually seek the same drive to accomplish tasks. That's where the slowdown is. Some applications recommend the application on one partition and media or data files be on another. They SHOULD be saying the app and data files be kept on seperate hard drives to reduce seek time on both. You are on a laptop, so you're stuck with a single drive. You may consider an external hard drive for your purposes.



[ Reply to This | # ]
Simpler and safer way to do this
Authored by: sjonke on May 10, '05 09:03:17AM

Note that if you don't mind seeing the disk image file, a much simpler and safer (since you're not playing with LoginHooks which are potentially dangerous as they can leave you unable to login if the script is in err) way to achieve the same thing is to create a disk image (read/write or sparse), naming it and placing it wherever you like and add it to your "Startup Items" in the "Accounts" preferences and it will be mounted at login. The disk image can be encrypted, which is probably the most useful thing to do with this.

---
--- What?



[ Reply to This | # ]
Typo
Authored by: juz10mac on May 12, '05 10:00:12AM
It occurs to me that I have a typo in the second line of my uninstallation procedure. It should be
sudo rm -f /Library/Hooks/MountFakePartition
and not
sudo rm -f /Library/Hooks/MountFakePartion
I'm sorry if this has caused anyone any inconvenience .

[ Reply to This | # ]
Create a new disk partition without partitioning
Authored by: macman_lt on May 21, '05 04:50:23AM

When the new fake partition is created, can I format the system disk without loosing the data in the created partition?



[ Reply to This | # ]
Create a new disk partition without partitioning
Authored by: ibroughton on May 22, '05 08:53:09AM

It would depend where the fake partition was created. If it was on your system disk, then formatting it would loose the data on the fake partition as well.

---
The server is up but the site is down and I don't know which direction you are trying to go



[ Reply to This | # ]
Create a new disk partition without partitioning
Authored by: juz10mac on May 25, '05 05:29:17PM

If you follow my procedure step-by-step, the fake partition will be created on the system disk and formatting the system disk WILL erase it.



[ Reply to This | # ]