News, tips, partners, and perspectives for the Oracle Solaris operating system

Automounted Home Directory

Guest Author

If you're running a fresh installation of Solaris 11 Express (as opposed to an upgrade from OpenSolaris), you'll notice your home directory is now at the more appropriate /home/<username>, instead of /export/home/<username>.

bleonard@solaris:~$ pwd
bleonard@solaris:~$ grep bleonard /etc/passwd

In reality, the data for your home directory still resides at /export/home/<username>, it's just that the directory has been automounted for you at /home/<username>. This is configured in the file /etc/auto_home:

oracle@solaris:~$ cat /etc/auto_home 
# <license text removed>
# Home directory map for automounter



A big benefit of automating your home directory is that it now becomes very easy to relocate the location of the storage behind the directory. Say, for example, the rpool, in which the home directory is stored by default, starts running out of space. By changing the automount location, we can relocate our home directory to another disk, or even network attached storage (which would make it accessible from any instance of Solaris).

For this example I'm simply going to relocate my home directory to another disk I have available on the machine.

bleonard@solaris:~$ sudo format < /dev/null
Searching for disks...
Failed to inquiry this logical diskFailed to inquiry this logical diskdone
0. c7d0 <ئ���Pp�nD ����pȅ��ئ���pp�n4"��� cyl 2607 alt 2 hd 255 sec 63>
1. c8d0 <ئ���Pp�nD ����pȅ��ئ���pp�n4"��� cyl 33416 alt 2 hd 255 sec 63>
Specify disk (enter its number):

The new disk is c8d0 (I forget the reason why the output is messed up, but it gives me the information I need).

I'll create a new zpool using that disk:

bleonard@solaris:~$ sudo zpool create newpool c8d0

And then create a new file system for my home directory:

bleonard@solaris:~$ sudo zfs create -p newpool/home/bleonard 

Then copy my current home directory to its new location:

bleonard@solaris:~$ sudo cp -rp /export/home/bleonard /newpool/home 

The next step is to tell the automounter to use the new location as the backing store for my home directory by updating /etc/auto_home as follows:

bleonard@solaris:~$ grep bleonard /etc/auto_home 


Then reboot to re-establish the home directory at its new location:

bleonard@solaris:~$ sudo reboot

Now you can delete the old home directory in rpool, freeing up space:

bleonard@solaris:~$ sudo zfs destroy rpool/export/home/bleonard

For more information on the automounter, see the Task Overview for Autofs Administration.

Join the discussion

Comments ( 2 )
  • Mark J Musante Monday, February 14, 2011

    Better yet, rather than doing a zfs create/cp -rp operation, you can use zfs send | zfs recv

  • Bert JW Regeer Monday, February 14, 2011

    After the copying of the data, zfs unmount rpool/export/home/username, zfs set mountpoint=/export/home/username newpool/home/username, make sure everything is working correctly, then zfs destroy rpool/export/home/username.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.