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

Save space on UFS volumes System
When installing a new boot drive, I decided to follow some of the other stories and install a separate swap partition using an UFS system. But after I had everything up and running, I discovered that I had sized the swap volume too small for a net capacity of 1 GB.

Obviously faced with the necessity to repartition and restore everything, I remembered from university 20 years ago that Unix file systems use one disk sector (512 bytes) for every 13 inodes or so, eating lots of disk space. A quick man newfs revealed a default of a 2048 bytes block size per inode. So I ran this command:
newfs -i 4096 yourswapdevicehere
This saved half of the wasted space, freeing up the space I wanted.

Notes:
  • This will help on any UFS volume, unless you have tons of very small files to store that are better accommodated by smaller block sizes.
  • Memory is also handled in page sizes of 4096 byte, so this should give a slight performance boost when used on swap volumes.
  • Extended HFS files systems also utilize a block size of 4096 bytes by default.
[robg adds: I haven't tested this one, as I no longer use a separate swap partition...]
    •    
  • Currently 2.25 / 5
  You rated: 5 / 5 (4 votes cast)
 
[4,782 views]  

Save space on UFS volumes | 5 comments | Create New Account
Click here to return to the 'Save space on UFS volumes' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
UFS Volumes Limited to 4GB
Authored by: EatingPie on Jan 19, '05 02:03:56PM

Just an FYI here... and something that shouldn't matter with Swap Partitions...

Apple's UFS is limited to 4GB for individual files. Not yet an issue for too many people, but I deal with files that range from 8GB to 30GB, and these won't go onto a UFS partition!

-Pie

PS I still do NOT recommend using a Separate Swap Partition under Panther. Please read the following macosxhints thread if you are interested:

<http://www.macosxhints.com/article.php?story=20031104150206554&query=Swap+Partition >

---
-Pie
<http://www.storybytes.com>



[ Reply to This | # ]
Save space on UFS volumes
Authored by: DavidRavenMoon on Jan 19, '05 04:40:40PM

I wouldn't recommend UFS for OS X either. It has no benefits as compared to HFS+ for running OS X, and generally the performance is worse.

It seems a lot of people want to use UFS thinking they are on a UNIX or Linux box, as if it makes the whole experience geekier.

Mac OS X wasn't designed to use swap partitions or UFS.

---
G4/466, 1 GB, Mac OS X 10.3.7



[ Reply to This | # ]
Save space on UFS volumes
Authored by: _merlin on Jan 19, '05 07:47:16PM

UFS, being a BSD-style file system, is more efficient space-wise for storing large numbers of very small files. It's also less prone to corruption when more than 90% full. Some software requires a case-sensitive file system, and will therefore work on UFS but not HFS+.

However, UFS is a lot slower than HFS+.



[ Reply to This | # ]
Save space on UFS volumes
Authored by: DavidRavenMoon on Jan 20, '05 12:35:23PM
This is true, but pretty much only benefits when you are running BSD or some other UNIX OS. Whereas OS X has a BSD subsystem, it's not BSD and was designed to work with its native file system, which is HFS+. OS X already has a journaled file system, so corruption isn't much of an issue anymore, and the other features introduced with Panther, such as the optimizing, are absent in UFS.

Same holds true for dividing up your hard drive with UNIX/Linux style partitions. This is more work, and trouble, than it's worth, and was not the file system the OS was meant to operate with.

---
G4/466, 1 GB, Mac OS X 10.3.7

[ Reply to This | # ]

Save space on UFS volumes
Authored by: petri on Dec 10, '05 05:09:40PM

I think you're correct, but what I think what merlin meant is that UFS is a BSD-style file system in the sense that file systems could be divided into "families" of file systems. In this case, HFS+ would be a HFS-style, or Mac-style, file system. So, the efficiency of storing very many tiny files would thus depend on what style the file system was (in this case, merlin claims BSD-style fs'es win over HFS-style) without regard to however the OSX BSD subsystem is optimised. By the way, it seems to me like the BSD subsystem component is (mostly? only?) userland, which would mean that it doesn't really affect the fs driver's way of accessing files.

Also, the note about case-sensitive file names still applies.



[ Reply to This | # ]