Results 1 to 10 of 12

Thread: Editing fstab for conditional nfs mounting

Threaded View

  1. #1
    Join Date
    May 2010
    Ubuntu 12.04 Precise Pangolin

    Editing fstab for conditional nfs mounting

    I shall explain my situation below. I have set up a small network of 3 computers in our lab with ubuntu 11.04 (32 bit). I am using nfs for file sharing. The server is set up such that when the clients boot up, server's home will be mounted as the home of the clients also. For this I have added the following:

    1) in server's /etc/exports:
    /home clientIP(rw,sync,no_subtree_check)
    2) then restarted the nfs kernel server.

    3) Next is the contents of client's /etc/fstab:
    # /etc/fstab: static file system information.
    # Use 'blkid -o value -s UUID' to print the universally unique identifier
    # for a device; this may be used with UUID= as a more robust way to name
    # devices that works even if disks are added and removed. See fstab(5).
    # <file system> <mount point>   <type>  <options>       <dump>  <pass>
    proc            /proc           proc    nodev,noexec,nosuid 0       0
    # / was on /dev/sda6 during installation
    UUID=a33e6c76-f42f-4953-b93c-172160321ab2 /               ext4    errors=remount-ro 0       1
    # /boot was on /dev/sda1 during installation
    UUID=c05b9b15-ebcf-4945-b08d-34fede0e4273 /boot           ext4    defaults        0       2
    # /home was on /dev/sda7 during installation
    UUID=04d92ef1-6118-4ca2-8cee-77a69f2363dd /home           ext4    defaults        0       2
    # swap was on /dev/sda5 during installation
    UUID=8c09ada0-0d3c-44ed-a036-e96c04b08502 none            swap    sw              0       0
    /dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0
    # mount point for localhome
    UUID=04d92ef1-6118-4ca2-8cee-77a69f2363dd    /localhome    ext4    defaults    0    2
    #nfs mount from server
    server,sIP:/home    /home    nfs    nfsvers=3,_netdev,exec,dev,suid,rw    0       0

    The idea is to mount the home folder from server for all the users (user identification is made by suid option and new users are created with same uis and gid on both the server and the clients). Also in case the server is down or nfs mounting fails, the client(s) will mount the local home. And that's where the problem comes and I am at a loss what to do. If server is online, things work fine. For all users, the home will mount from the server. Also I have tested that anything saved locally can be accessed from the localhome. But in case server is down and i am trying to boot the clients, the following happens:
    1) The system will boot and the user login screen appears.
    2) After you login to a user with user name and password, the desktop does not come. Instead the following error messages will appear one by one:

    And then the desktop is blank. I can not do anything!

    Now I know why these are coming. Because of the condition in fstab, if server is offline, nfs mounting of home fails. As such there is no home directory for the user 'installer' and the .ICEauthority is not available. If I go to recovery mode and do sudo mount -a it tells me: "mount.nfs: No route to host". I was thinking is there a way to write a script or program the boot or add an option in fstab such that:
    Try mouning home from server (by nfs mount).
    If home mounting from server (using nfs) fails, then mount the home folder from "UUID=04d92ef1-6118-4ca2-8cee-77a69f2363dd" which is mounted on the /home locally using the code below:
    # /home was on /dev/sda7 during installation
    UUID=04d92ef1-6118-4ca2-8cee-77a69f2363dd /home ext4 defaults 0 2
    I hope I have been able to explain my problem. Please help me quickly, anyone. Thanks in advance.
    Last edited by sd@ksu; February 24th, 2012 at 03:49 PM.

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts