Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So, I bought a NAS, which I configured successfully in /etc/fstab, on mu Kubuntu 10.10 Thinkpad x40. It works just fine when I am at home. A few days I went out with my laptop and the problem is, that when not at home, both suspend and hibernate functions seem forever to work.

I commented out the entry on fstab and the laptop started to work as expected. I played with autofs, but it seems just dies at one moment and I cannot access anything. It works for some time, and then just goes off.

Is there any consistent way, to make my laptop access the drive when at home and work OK when away?

Probably a script that runs at startup, checks if the mount is there and mounts it if available... or a script that umount the drive at suspend|hibernate and loads it back at startup.

Any useful ideas?

share|improve this question

I consider the best way to mount NAS to a laptop which is on the go, in Ubuntu, to mount it via gvfs. The only downside is that KDE based programs, if you use any, might fire warnings if you copy files to the NAS with them. I hope this helps somone.

Another useful way to do this is use wicd - it allows scripts to be executed at specific wifi post-connect or pre-disconnect(the disconnect should be triggered bu the system - shutdown, suspend, disconnect, hibernate). Thus, a useful script could be written which mounts or umounts the NAS when connecting or disconnecting from the home wifi. Wicd is so buggy under unity2D, so it is almost unusable

share|improve this answer

Would you try this:
(Instead of using fstab to mount, we will use a script that will run at startup).

1) Test to see if this work:

sudo mount -t cifs -o username=*,password=*,uid=1000,gid=1000,noperm,_netdev,iocharset=utf8,file_mode=0777,dir_mode=0777­,vers$ // /media/MyBookLive   

2) When you get an acceptable working mount command, then
Edit the file /etc/rc.local (gksu gedit /etc/rc.local) to look like this:

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing 
# but desgua has changed it 
# to mount a samba folder
mount -t cifs -o username=*,password=*,uid=1000,gid=1000,noperm,_netdev,iocharset=utf8,file_mode=0777,dir_mode=0777­,vers$ // /media/MyBookLive 

3) Test to see if you can hibernate with the NAS turned off without delays.

Other useful information:

To check if the NAS is mounted you can use:
mountpoint /mnt/your_mount_folder_name

To unmount:
sudo umount /mnt/your_mount_folder_name

or, if you get errors with the above, you can use:
sudo umount -l /mnt/your_mount_folder_name

You can combine both so it will only try to unmount if it is mounted:
mountpoint /mnt/your_mount_folder_name && sudo umount -l /mnt/your_mount_folder_name

You can mount manually so you don't get trouble with fstab:
sudo mount -t cifs uid=1000,gid=1000 // /mnt/your_folder_name

share|improve this answer
My fstab <br/> // /media/MyBookLive cifs noperm,_netdev,username=*,password=*,iocharset=utf8,file_mode=0777,dir_mode=0777‌​,vers$<br/> auto.master /- /etc/ --timeout=2 --ghost<br/> <br/> /media/disk -fstype=vfat,uid=1002,gid=1002,umask=002 :/dev/sdb1 I need a way to fix fstab errors on suspend\hibernate when drive not present, autofs errors with mounts or just a third option I missed. Manual mount is not an option, as my PC is 95% at home. Or a script that mounts at a specific network present – deckoff Apr 24 '11 at 19:23
What happens if (when not at home) you manually unmount it before hibernate? – desgua Apr 24 '11 at 19:58
I've edited the answer, can you test it? – desgua Apr 25 '11 at 1:19
I found that both gnome and kde offer way to bookmark a drive. When a drive is bookmarked, it does not hang for so much time, and I don't have problems with any apps hanging or shutdown slow. Unfortunately, the suggested options for mount will not stop apps from hanging when foder unreachable... Sorry for belated answer. – deckoff Oct 25 '11 at 17:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.