====== Ubuntu 14.10 Home Directories over iSCSI ====== The following setup assumes that you know how to configure a iSCSI target and initiator along with setting up a new filesystem on a iSCSI target. Now assume the following * You have a ext4 filesystem on the iSCSI target. * The iscsi initiator connects/logs into the target on bootup ===== Setup Autofs to mount the iSCSI filesystem ===== I deiced to use autofs since it is a nice way to have a automated remounting of the filesystem if the connection is lost to the iSCSI target. ==== Install packages ==== apt-get install autofs ==== Configure ==== Edit **/etc/auto.master** /netAutofs /etc/auto.netAutofs --timeout=300 Edit **/etc/auot.netAutofs** netHomes -fstype=auto :UUID="00ab362b-4241-4670-b130-84dc3b0c860c" The preceding configurations will mount the parition with UUID **00ab362b-4241-4670-b130-84dc3b0c860c** on **/netAutofs/netHomes**.. This again assumes the the iSCSI target that holds the referenced filesystem is connected. ===== Misc Fixes ===== ==== Fix filesystem not available shortly after bootup ==== Edit **/etc/rc.local**, This will fix the issue that the filesystem is not availible for multiple seconds to a few min. after bootup. blkid /etc/init.d/autofs restart ==== Fix filesystem disappearing after suspend ==== Next we need to make at least one interface unmanned by **Network Manager** since NM disconnects all managed interfaces when the computer suspends. To do this we need to edit **/etc/network/interfaces** auto eth0 iface eth0 inet dhcp ==== Fix not filesystem no unmounting during shutdown ==== It appears that during the shutdown or reboot process the previous user sessions are not cleaned up very well. This causes the shutdown process to get stuck with open files on the mounted iSCSI filesystems. I was able to fix this be adding the following to **/etc/init.d/umountiscsi.sh** while [ "`lsof | grep /netAutofs/netHomes | tr -s \" \" | cut -d \" \" -f2`" != "" ] do echo "Killing User Processes" LSOF_PROCS="`lsof | grep /netAutofs/netHomes | tr -s \" \" | cut -d \" \" -f2`" for i in ${LSOF_PROCS} do kill ${i} > /dev/null 2>&1 done sleep 1 done