I've gotten iSCSI to automount... testing NFS on top of that now.
mini HowTo:
NOTE: this will only work with one iSCSI target until Debian adds some udev rules that allow for consistent iSCSI mapping to /dev targets (i.e. can't use /dev/sdc1 in fstab because with two iSCSI targets you can't be sure which one will get /dev/sdc...)
I followed this to attach to my iSCSI target ->
http://www.cyberciti.biz/faq/howto-setup-debian-ubuntu-linux-iscsi-initiator/
After that I added this line to
/etc/fstab (note the _netdev option):
Code:
/dev/sdc1 /var/lib/vz ext3 _netdev 0 0
Debian will not mount filesystems with the _netdev option by default. This can be seen in /etc/init.d/mountall.sh:
Code:
mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs \
-O no_netdev
This seems to be the way RH and maybe Suse are doing their iSCSI automounting so it should hold up.
Then just add this file at
/etc/init.d/mount_netdev.sh
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: mount_netdev
# Required-Start: network, open-iscsi
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Mount/Unmount filesystems with _netdev option (iSCSI)
# Description:
### END INIT INFO
PATH=/sbin:/bin
. /lib/lsb/init-functions
do_start() {
#
# Mount local file systems in /etc/fstab.
#
mount_all_netdev() {
mount -a -O _netdev
}
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Mounting _netdev filesystems"
mount_all_netdev
log_action_end_msg $?
else
log_daemon_msg "Will now mount _netdev filesystems"
mount_all_netdev
log_end_msg $?
fi
}
do_stop() {
#
# Mount local file systems in /etc/fstab.
#
umount_all_netdev() {
umount -a -O _netdev
}
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Unmounting _netdev filesystems"
umount_all_netdev
log_action_end_msg $?
else
log_daemon_msg "Will now umount _netdev filesystems"
umount_all_netdev
log_end_msg $?
fi
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: mountall.sh [start|stop]" >&2
exit 3
;;
esac
:
and make this script executable:
Code:
chmod 755 /etc/init.d/mount_netdev.sh
Finally enable this script with the command:
Code:
update-rc.d mount_netdev.sh start 42 2 3 4 5 . stop 33 0 1 6 .
This makes sure it mounts after networking has started and unmounts before networking has been stopped.
Finally, I changed the sequence numbers of the open-iscsi startup script in /etc/rc2.d to start up after networking, but then I changed it back to 20 and it still seems to work... It seems that iSCSI is smart enough to do it's thing once networking comes up. Which is nice.
Also, I'm not sure it's always necessary, but, make sure you have
in /etc/iscsd.conf and possibly everywhere else node.startup (or node[0].startup) is mentioned which includes /etc/iscsi/nodes/
node_name/ip_address,port
