Page 1 of 1

How do I recover from a lost network share?

Posted: Sun Jul 07, 2024 8:16 am
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?


Re: How do I recover from a lost network share

Posted: Sun Jul 07, 2024 10:32 pm
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.


Re: How do I recover from a lost network share

Posted: Mon Jul 08, 2024 2:36 am
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!).


Re: How do I recover from a lost network share

Posted: Mon Jul 08, 2024 8:57 am
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.


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

Posted: Mon Jul 22, 2024 2:00 am
by jp734

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


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

Posted: Sat Aug 17, 2024 12:07 am
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


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

Posted: Sun Aug 18, 2024 10:22 am
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.


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

Posted: Mon Aug 19, 2024 12:44 pm
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!


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

Posted: Sat Oct 05, 2024 1:53 pm
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.