Finally!
ZFS root has been in Indiana (aka OpenSolaris 2008.05) for a while, but I prefer Solaris Express.
As of build 90, it’s supported by the installer.
I installed it on my crappy P4 test box : 1Gb Ram, twin 40Gb disks. Burn the DVD ISO and boot it if you want to play along.
the secret handshake
Choose ‘Solaris Express’ (not ‘Solaris Express Developer Edition), then ‘3 . Solaris Interactive Text (Desktop Session)‘
Only the ‘Interactive Text’ options have the ZFS root option.
Running ‘Desktop’ not ‘Console’ session lets you start a Terminal
to enable compression on the pool when its created (40Gb disks, remember?).
Enabling ZFS compression won’t convert blocks that have already been written (good explanation here), so you want to do it before you populate the filesystem.
you know the drill
- Choose ‘English’
- [X starts up]
- rightclick the desktop and choose ‘programs -> terminal’
- system id
- networked: yes
- DHCP: yes
- IPv6: no
- [it'll do a DHCP request]
- Kerberos: no
- Name service : None (no need if you’re on DHCP)
- NFS domain : Use NFSv4 domain derived by the system
- Time Zone : Europe -> Britain (UK)
- root password : ‘secret’ (heh)
- F2. Standard install
- Manually eject DVD
- Manually reboot
- Choose Media : CD/DVD
- Accept license
- Geographic regions – leave all blank
- System Locale : POSIX C (C)
- Web Start : None
- Choose Filesystem Type : ZFS
- Select Software : Entire Distribution
- choose both disks (this makes a ZFS mirrored pool)
- select ‘put /var on a separate dataset’ (personal choice, but stops / filling up)
- Skip ‘Mount Remote File Systems’
fingers on buzzers
In the Terminal you opened, create a script called ‘readysetgo.sh’
#! /bin/sh
until [ "`zpool list rpool`" ];
do
:
done
zfs set compression=on rpool
until [ "`zfs list rpool/ROOT`" ];
do
:
done
zfs set compression=on rpool/ROOT
Then just run
sh readysetgo.sh
in the Terminal you opened earlier.
You can now start the install. Once the pool is created, it’ll have compression
enabled automatically.
scrooged
Let’s see how much benefit we got. The ‘Entire Distribution’ took about
5Gb of disk without compression, looks to be about 3 Gb with..
vera:~ $ zfs get -r compressratio rpool
NAME PROPERTY VALUE SOURCE
rpool compressratio 1.62x -
rpool/ROOT compressratio 1.74x -
rpool/ROOT/snv_90 compressratio 1.74x -
rpool/ROOT/snv_90/var compressratio 2.60x -
rpool/dump compressratio 1.00x -
rpool/swap compressratio 1.37x -
vera:~ $
(UPDATED - thanks to Glenns blog for the neater script, and Andrew in the comments for tidying it up further)

Since your hypnotoad we must try it …
Works great on SX:CE (Solaris 11) - make it “really SXCE”.
Beating the buzzer is easy:
1. Type your command to turn on compression but don’t hit return.
2. Make your way up to the “Profile” (”F2_Begin Installation”) screen.
3. Hit “F2″ and mouse to your other window with the compress command in it.
4. Wait for this in the first window (assuming mirrored root):
Preparing system for Solaris install
Configuring disk (c1t0d0)
- Creating Fdisk partition table
- Creating Solaris disk label (VTOC)
Configuring disk (c1t1d0)
- Creating Fdisk partition table
- Creating Solaris disk label (VTOC)
- Creating pool rpool
*** NOW ***
- Creating swap zvol for pool rpool
- Creating dump zvol for pool rpool
If you hit [Enter] where it says “*** NOW ***” you won’t get your cursor back until the “Creating dump zvol for pool rpool” is completed and you can hit [Enter] later than that; but then you’ll miss a few Mbytes …
It worked for me but all I got was:
$ zfs get -r compressratio rpool
NAME PROPERTY VALUE SOURCE
rpool compressratio 1.54x -
rpool/ROOT compressratio 1.65x -
rpool/ROOT/snv_90 compressratio 1.65x -
rpool/ROOT/snv_90/var compressratio 1.71x -
rpool/dump compressratio 1.00x -
rpool/export compressratio 1.00x -
rpool/export/home compressratio 1.00x -
rpool/export/home/dick compressratio 1.00x -
rpool/swap compressratio 1.00x -
Still I think it was good than it did not compress the swap.
Thanks for the tip!
Maybe you used b91 (latest) and the distro is different enough to affect the compression ratio?
Thanks for the comment, you prodded me into finding a neater way of getting the timing right, and updated the post to show it.
This is all a hack of course - be nice if there was an install option just to do this, maybe it’s coming.
2 things: firstly SXCE doesn’t need you to use pfexec, since the terminal is already running as root.
Secondly, here is a script that also makes the root pool compressed.
The script (I’m calling it compress.sh) is as follows:
#! /bin/sh
until [ "`zpool list rpool`" ];
do
:
done
zfs set compression=on rpool
until [ "`zfs list rpool/ROOT`" ];
do
:
done
zfs set compression=on rpool/ROOT
Then to run it:
chmod +x compress.sh
./compress.sh .
Cheers
Andrew.
@andrew : thanks , that’s a lot cleaner; I’ve updated the post to include both changes.
@dick : no problem. It took a bit of experimenting to get that - I was surprised how easy it was in the end!
If you invoke the script using
sh readysetgo.sh
then you don’t need the shebang line ( #! /bin/sh ) , so that makes the script one line shorter as well.
Cheers
Andrew.
Here’s a slightly more fancy version that prints success/failure messages and also disables access time stamps on all files, which should speed things up a little:
#! /bin/sh
echo
echo “Waiting for root pool to be created…”
until [ "`zpool list rpool 2>/dev/null`" ];
do
:
done
TEMP=`zfs set compression=on rpool 2>/dev/null`
if [ $? -eq 0 ]; then
echo “Successfully enabled compression on rpool”
else
echo “ERROR: could not enable compression on rpool”
fi
TEMP=`zfs set atime=off rpool 2>/dev/null`
if [ $? -eq 0 ]; then
echo “Successfully disabled access time updates on rpool”
else
echo “ERROR: could not disable access time updates on rpool”
fi
echo
echo “Waiting for rpool/ROOT to be created…”
until [ "`zfs list rpool/ROOT 2>/dev/null`" ];
do
:
done
TEMP=`zfs set compression=on rpool/ROOT 2>/dev/null`
if [ $? -eq 0 ]; then
echo “Successfully enabled compression on rpool/ROOT”
else
echo “ERROR: could not enable compression on rpool/ROOT”
fi
TEMP=`zfs set atime=off rpool/ROOT 2>/dev/null`
if [ $? -eq 0 ]; then
echo “Successfully disabled access time updates on rpool/ROOT”
else
echo “ERROR: could not disable access time updates on rpool/ROOT”
fi
echo
Cheers @Andrew, as you can tell shell isn’t my native language ( http://number9.hellooperator.net/articles/2007/10/12/zfs-rolling-snapshots )
Personally I don’t see the atime tweak as a big deal, since you can change that afterwards easily. Compression is a special case, since it really helps to enable that while the filesystems are empty. Might help others though (this post gets a fair bit of traffic, which is a bit of a shock to me).
I’m hoping for an installer checkbox at some point to make all this moot anyway