How do I recover from a lost network share?

Moderators: kirk, jamesbond, p310don, JakeSFR, step, Forum moderators

Post Reply
User avatar
p310don
Posts: 356
Joined: Tue Dec 03, 2019 7:17 am
Location: Brisbane, Australia
Has thanked: 72 times
Been thanked: 103 times

How do I recover from a lost network share?

Post by p310don »

I have a hard drive that is failing.

I am trying to get as much data off of it before it dies forever.

I have the computer with the failing drive connected to one computer, and another computer is copying the data across. Inevitably the failing drive fails and unmounts (or freezes) which causes the network share to disappear.

If something was in the middle of something, eg copying, that share won't unmount, and the computer gets a zombie share that stops the PC from shutting down quickly and cleanly.

I can get a similar thing to happen if a network share is mounted when I try to shut down. The computer hangs, but does eventually shut down.

Obviously unmounting network shares before shutting down will solve half of this battle, but is there a better way to resolve either of these situations?

step
Posts: 546
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 57 times
Been thanked: 198 times
Contact:

Re: How do I recover from a lost network share

Post by step »

Perhaps umount --lazy can help.

Code: Select all

       -l, --lazy
           Lazy unmount. Detach the filesystem from the file hierarchy now,
           and clean up all references to this filesystem as soon as it is not
           busy anymore.

           A system reboot would be expected in near future if you’re going to
           use this option for network filesystem or local filesystem with
           submounts. The recommended use-case for umount -l is to prevent
           hangs on shutdown due to an unreachable network share where a
           normal umount will hang due to a downed server or a network
           partition. Remounts of the share will not be possible.

For a permanent solution, how are you mounting/unmounting the share? If through SMB-browser (/usr/share/Shares/Network) you can right-click the troubled share icon in ROX, and select "Look inside" to reveal some files. Edit the "unmount it" script, and append "--lazy" after "unmount". The script file is overwritten if SMB-browser recreates the share icon.

User avatar
p310don
Posts: 356
Joined: Tue Dec 03, 2019 7:17 am
Location: Brisbane, Australia
Has thanked: 72 times
Been thanked: 103 times

Re: How do I recover from a lost network share

Post by p310don »

Thanks @step

umount --lazy looks like exactly what I need.

I have in the past used suspend for my machine, which doesn't matter if there is a missing network share, but I have a new PC that boots in a few seconds, so figure shutdown is better, except for the network share malarky.

lazy should fix that.

For this particular instance with the dying drive, I didn't realise it was dying (I only assume it is now) so was doing some work with files on it via the network. I couldn't kill the processes that were working when the drive dropped out from the network share, and then I couldn't unmount it, and then the PC wouldn't shut down at all. Ended up having to do a hard reset, which isn't ideal on a new machine (nor any machine!).

step
Posts: 546
Joined: Thu Aug 13, 2020 9:55 am
Has thanked: 57 times
Been thanked: 198 times
Contact:

Re: How do I recover from a lost network share

Post by step »

There are a few other tools at your disposal. To single out which processes encumber the mountpoint you can use lsof /real/path/to/mountpoint. To shutdown the system in an orderly fashion you could use MagicSysRq.

User avatar
jp734
Posts: 204
Joined: Fri Jul 17, 2020 10:23 pm
Has thanked: 96 times
Been thanked: 97 times

Re: How do I recover from a lost network share?

Post by jp734 »

I have IDE/SATA TO USB caddies for scenarios like this. It's very handy.

The Art of Magic and The Magic of Art

libertas
Posts: 78
Joined: Thu Apr 22, 2021 8:35 pm
Has thanked: 11 times
Been thanked: 2 times

Re: How do I recover from a lost network share?

Post by libertas »

I recomend a few things:
1. Mount the filesystem read only. Which is it?
2. Can copy from there with a tool like fsarchiver https://www.fsarchiver.org
3. Or in block mode using dd_rescue that doesnt stop at bad sectors.
4. In case of need after the backup, you may try photorec to salvage some important files that could ot be copied.

There's a Reddit comment that has logic:
Clone the disk to an external drive. Cloning will reduce the movement of the failing disk. Copying individual files/folders will have the disk seeking all over the drive.
In this case, dd_rescue would be a good tool.

It is mentioned another tool HddSuperClone that seems better that dd_rescue, but I never used it.
https://www.hddsuperclone.com/hddsuperclone

jamesbond
Posts: 716
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 124 times
Been thanked: 402 times

Re: How do I recover from a lost network share?

Post by jamesbond »

Thank you @libertas.
1. fsarchiver is already included in Fatdog for many years now.
2. ddrescue will be included in Fatdog 903 release onwards.
3. testdisk/photorec was available in gslapt for previous release, not it's apparently not available for 90x releases yet. I'll see if we can add them later.

I don't know anything about HddSuperClone, never heard about it, but may be useful.

libertas
Posts: 78
Joined: Thu Apr 22, 2021 8:35 pm
Has thanked: 11 times
Been thanked: 2 times

Re: How do I recover from a lost network share?

Post by libertas »

HddSuperClone has been released as open source https://www.hddsuperclone.com/hddsuperclone/purchase in 2022.

From the author

I no longer have the time to maintain this project. I am planning on ending major support for HDDSuperClone, so I am making the PRO version free. I has also been made open source, and the source code is in the downloads area. The most recent version 2.3.3 downloads now have the full pro features unlocked without the need for a license.

So @jamesbond , good news for us!

libertas
Posts: 78
Joined: Thu Apr 22, 2021 8:35 pm
Has thanked: 11 times
Been thanked: 2 times

Re: How do I recover from a lost network share?

Post by libertas »

@jamesbond, just to add that there are two tools that are named in a similar way but are different.

There's https://www.gnu.org/software/ddrescue/ and https://www.garloff.de/kurt/linux/ddrescue/.
Each has some advantages.

Post Reply

Return to “FatDog”