site  contact  subhomenews

Unmounting network shares

February 19, 2012 — BarryK
Not my area of expertise! Recently, Forum member ldolse posted a patch for /etc/rc.d/rc.shutdown to properly unmount network shares. You will find that in Wary/Racy 5.2.2.

However, Forum member zekebaby reports that does not work for him:

I have thought about it, and patched rc.shutdown, inserted zekebaby's code just below ldolse's code:

#111107 ldolse: unmount network shares before taking down the network

#(see 111106, need to do it sooner, but 111106 will remount read-only if failed to umount here)
for MOUNTPOINT in `mount | grep '^//' | cut -d ' ' -f 3 | tr '\n' ' '`
umount -f $MOUNTPOINT
#120219 hmmm, zekebaby reports above does not work for him. i looked up an ex: mount -t nfs /mnt/bozo
#so this is zekebaby's patch: (see
for MOUNTPOINT in `mount | grep ':' | cut -d ' ' -f 3 | tr '\n' ' '`
umount -f $MOUNTPOINT


Re: Unmounting network shares
Username: shinobar
I would like to propose another solution [code]#120203 pemasu and shinobar: space in smb or cifs share causes hanging in shutdown for T in cifs smbfs nfs sshfs; do umount -a -t $T done[/code]

Username: ttuuxxx
"Hi Barry have you heard of TuxOnIce? Its a kernel patch kind of like a pupsave but a bit better and faster. Quote" TuxOnIce is most easily described as the Linux equivalent of Windows' hibernate functionality, but better. It saves the contents of memory to disk and powers down. When the computer is started up again, it reloads the contents and the user can continue from where they left off. No documents need to be reloaded or applications reopened and the process is much faster than a normal shutdown and start up. " I stumbled across this when reading of a linux kernel fork ttuuxxx

Re network shares
Username: BarryK
"shinobar, that looks like a good solution. I just looked in the umount docs, this also will work: [i]umount -a -t cifs,smbfs,nfs,sshfs[/i] However, this requires the full umount. In Woof, umount is a script that currently only calls the busybox umount I think, which does not allow the -t option.

umount -t not supported
Username: pemasu
"When I originally tried to find a solution to network share with space in name, I also noticed that -t was not documented. In Exprimo...I have implemented little simpler command without loop: [code]#120203 pemasu: space in smb or cifs share causes hanging in shutdown umount -a -t cifs #120203[/code] Shinobar used that idea to include all network shares. Mine solution was targeted to jrb`s Pupserver to unmount it at shutdown. In my tests anyway...the command works and I have used it in several builds now. I knew that -t is not documented, but since it worked, I didnt care, lol.

Username: pemasu
"TuxonIce is just hibernation functionality. It is already in kernels, when you enable it. In my kernels you can hibernate already. No need for TuxonIce. You just need to give kernel boot time parameter: resume=/dev/sdXX But...hibernating writes to the swap partition and locks it. It is not in use until you boot again that hibernated Puppy. When you hibernate, you can power off computer and you need to boot the hibernated puppy until swap is usable. Also hibernating ie saving to the swap the running snapshot of puppy is slow process. It is much faster to save your stuff and be happy. Puppy boots much faster than loading hibernated puppy. Of course if you dont want to create savefile, you can install pets, open documents and do what you want....hibernate...shut down comp....and boot the hibernated puppy which starts from where you left..continue to where you left. It works....I have used it several times.... But no need for TuxOnIce. Just compile kernel with hibernating enabled.

Hibernate with acpitool -S
Username: pemasu
"Sorry...I forgot to tell how you hibernate. Use acpitool: #acpitool -S It launches the saving to the swap partition and shuts down the computer, real shutdown, power off. And you need to have that resume=/dev/sdXX kernel boot parameter in kernel row to have target which resumed partition will be writed back. resume=/dev/sdXX need to be pointed to your swap partition. Fluppies, all my builds and Saluki has natively support in kernel for hibernating and they have acpitool preinstalled. Have fun !

Network shares umount
Username: BarryK
"Ok, I have put this into rc.shutdown: umount -a -t cifs,smbfs,nfs,sshfs ...although you guys haven't told me if the busybox umount accepts the comma delimiter.

Re comma delimiter
Username: BarryK
"I tested with the comma, works ok.

Tags: woof