How to relocate the /export and /export/home filesystems on Solaris 10.

By default Solaris installs the /export and /export/home filesystems in the root zfs pool, if you picked ZFS and not UFS as the filesystem. I wanted to relocate /export and /export/home to a larger ZFS pool other than the root pool as I wanted to separate the user’s data from the OS.

The first thing to do is determine the available disk and slice. Use the format command to list the disks and slices.

# format
Searching for disks…done

AVAILABLE DISK SELECTIONS:
0. c0t0d0
/pci@0,600000/pci@0/pci@0/scsi@0/sd@0,0
1. c0t1d0
/pci@0,600000/pci@0/pci@0/scsi@0/sd@1,0
2. c3t60060E8005652C000000652C00002100d0
/scsi_vhci/ssd@g60060e8005652c000000652c00002100
Specify disk (enter its number):

# zpool create epool c3t60060E8005652C000000652C00002100d0s7

This will create the zfs pool called epool on disk c3t60060E8005652C000000652C00002100d0, slice 7.

Confirm that the pool was created with the command zpool list.

bash-3.00# zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
epool 472G 174K 472G 0% ONLINE –
rpool 25.5G 5.41G 20.1G 21% ONLINE –

Create a snapshot of /export and /export/home. The -r option created a recursive snapshot, so you do not have to manually create the snapshot for /export/home as well.

# zfs snapshot -r rpool/export@snapshot

Confirm that the snapshots were crearted, they are rpool/export@snapshot and rpool/export/home@snapshot.

# zfs list
NAME USED AVAIL REFER MOUNTPOINT
epool 72K 465G 21K /epool
rpool 7.41G 17.7G 97K /rpool
rpool/ROOT 4.41G 17.7G 21K legacy
rpool/ROOT/zfsboot 4.41G 17.7G 4.35G /
rpool/ROOT/zfsboot/var 69.2M 17.7G 69.2M /var
rpool/dump 1.00G 17.7G 1.00G –
rpool/export 44K 17.7G 23K /export
rpool/export@snapshot 0 – 23K –
rpool/export/home 21K 17.7G 21K /export/home
rpool/export/home@snapshot 0 – 21K –
rpool/swap 2G 19.7G 16K –

Now restore the snapshots to the new zfs pool called epool.

# zfs send rpool/export@snapshot | zfs receive epool/export
# zfs send rpool/export/home@snapshot | zfs receive epool/export/home

Confirm that the snapshots were restored to epool.

# zfs list
NAME USED AVAIL REFER MOUNTPOINT
epool 134K 465G 23K /epool
epool/export 44K 465G 23K /epool/export
epool/export@snapshot 0 – 23K –
epool/export/home 21K 465G 21K /epool/export/home
epool/export/home@snapshot 0 – 21K –
rpool 7.41G 17.7G 97K /rpool
rpool/ROOT 4.41G 17.7G 21K legacy
rpool/ROOT/zfsboot 4.41G 17.7G 4.35G /
rpool/ROOT/zfsboot/var 69.2M 17.7G 69.2M /var
rpool/dump 1.00G 17.7G 1.00G –
rpool/export 44K 17.7G 23K /export
rpool/export@snapshot 0 – 23K –
rpool/export/home 21K 17.7G 21K /export/home
rpool/export/home@snapshot 0 – 21K –
rpool/swap 2G 19.7G 16K –

Now you need to redirect the mount points for /export and /export/home. They are still pointing to rpool/export and rpool/export/home. List the mount points with the zfs mount command.

# zfs mount
rpool/ROOT/zfsboot /
rpool/ROOT/zfsboot/var /var
epool /epool
rpool/export /export
rpool/export/home /export/home
rpool /rpool
epool/export /epool/export
epool/export/home /epool/export/home

Unmount /export and /export/home becasue they are currently mounted.

# zfs unmount /export/home
# zfs unmount /export

Now redirect the mount point /export to epool/export.

# zfs set mountpoint=/export epool/export

Redirect the mount point /export/home to epool/export/home.

# zfs set mountpoint=/export/home epool/export/home

Confirm the changes.

# zfs mount
rpool/ROOT/zfsboot /
rpool/ROOT/zfsboot/var /var
epool /epool
rpool /rpool
epool/export /export
epool/export/home /export/home

Reboot the server for the changes to take effect.

After the server restarts list the filesystems to confirm the changes.

# zfs list
NAME USED AVAIL REFER MOUNTPOINT
epool 219K 465G 21K /epool
epool/export 84K 465G 23K /export
epool/export@snapshot 21K – 23K –
epool/export/home 40K 465G 22K /export/home
epool/export/home@snapshot 18K – 21K –
rpool 7.42G 17.7G 99K /rpool
rpool/ROOT 4.42G 17.7G 21K legacy
rpool/ROOT/zfsboot 4.42G 17.7G 4.35G /
rpool/ROOT/zfsboot/var 69.3M 17.7G 69.3M /var
rpool/dump 1.00G 17.7G 1.00G –
rpool/export 75K 17.7G 23K /export
rpool/export@snapshot 16K – 23K –
rpool/export/home 36K 17.7G 21K /export/home
rpool/export/home@snapshot 15K – 21K –
rpool/swap 2G 19.7G 16K –

You need to delete the old /export and /export/home which are pointing to rpool/export and rpool/export/home respectively.

# zfs destroy -r rpool/export

Confirm the filesystems were deleted.

# zfs list
NAME USED AVAIL REFER MOUNTPOINT
epool 219K 465G 21K /epool
epool/export 84K 465G 23K /export
epool/export@snapshot 21K – 23K –
epool/export/home 40K 465G 22K /export/home
epool/export/home@snapshot 18K – 21K –
rpool 7.42G 17.7G 99K /rpool
rpool/ROOT 4.42G 17.7G 21K legacy
rpool/ROOT/zfsboot 4.42G 17.7G 4.35G /
rpool/ROOT/zfsboot/var 69.3M 17.7G 69.3M /var
rpool/dump 1.00G 17.7G 1.00G –
rpool/swap 2G 19.7G 16K –

Delete the snapshots to free up space in the zfs pool rpool.

# zfs destroy epool/export@snapshot
# zfs destroy epool/export/home@snapshot

Confirm the snapshots were deleted.

# zfs list
NAME USED AVAIL REFER MOUNTPOINT
epool 153K 465G 21K /epool
epool/export 45K 465G 23K /export
epool/export/home 22K 465G 22K /export/home
rpool 7.42G 17.7G 99K /rpool
rpool/ROOT 4.42G 17.7G 21K legacy
rpool/ROOT/zfsboot 4.42G 17.7G 4.35G /
rpool/ROOT/zfsboot/var 69.3M 17.7G 69.3M /var
rpool/dump 1.00G 17.7G 1.00G –
rpool/swap 2G 19.7G 16K –

About Andrew Lin

Hi, I have always wanted to creat a blog site but never had the time. I have been working in Information Technology for over 15 years. I specialize mainly in networks and server technologies and dabble a little with the programming aspects. Andrew Lin

View all posts by Andrew Lin →