Automounted Home Directory

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
/home/bleonard

bleonard@solaris:~$ grep bleonard /etc/passwd 
bleonard:x:54324:1::/home/bleonard:/usr/bin/bash

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
#
oracle  	localhost:/export/home/&
bleonard	localhost:/export/home/&
+auto_home

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
Password: 
Searching for disks...
Failed to inquiry this logical diskFailed to inquiry this logical diskdone


AVAILABLE DISK SELECTIONS:
       0. c7d0 <ئ���Pp�nD����pȅ��ئ���pp�n4"��� cyl 2607 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1,1/ide@0/cmdk@0,0
       1. c8d0 <ئ���Pp�nD����pȅ��ئ���pp�n4"��� cyl 33416 alt 2 hd 255 sec 63>
          /pci@0,0/pci-ide@1,1/ide@1/cmdk@0,0
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
Password:

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 
bleonard	localhost:/newpool/home/&
 
  

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

bleonard@solaris:~$ sudo reboot
Password:

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

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

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

Comments:

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

Posted by Mark J Musante on February 14, 2011 at 07:09 PM GMT #

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.

Posted by Bert JW Regeer on February 14, 2011 at 09:27 PM GMT #

Could you please verify if this works on Solaris 11 11/11.

At step, $ grep bleonard /etc/auto_home >>>
bleonard localhost:/export/home/bleonard

The automounter continue to use the old location as the backing store for the home directory.

thank you.

Posted by guest on January 28, 2012 at 06:01 PM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Connect with Oracle Solaris:


Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today