PDA

View Full Version : broken links everytime I turn off ext drive?



mgh
2007-07-01, 15:38
Hi All,

Still playing around trying to get Linux to work for me. Using LinuxMint, and really like it.

Most of what I have done before scanning my library is made links to files and folders. It appears as though anytime I turn off my external hard drive, all the links I have made to files on it are broken. The links to files on my internal drives are all OK.

I don't think my read/write access is a problem, as all the links are on this ext drive (ntfs).

Any ideas?

I try to always turn off the external drive when I turn off the PC.

Thanks for any help.

Mark Lanctot
2007-07-01, 15:47
I'm trying to understand the issue - why is this a problem? When you shut off your external drive, it gets forcibly unmounted (Ubuntu, for example, will complain when you do this). Links made to those files will be broken because the destination is no longer mounted. But even without the links, you couldn't access them anyway, the drive is unmounted.

Am I missing something?

mgh
2007-07-01, 17:10
Sorry, let me try again.

I make my links, then I turn off my PC, then turn off the external drive. I reboot, turn on the external, and the links are broken, so I have music that I can not play on my SB.

What seems strange to me, is the only links that are broken, are the links to files on the external, and the folder that SS scans is on that same external.

So this is what I have:

All my music is done with links. All of those links are in a directory on this external. This is the directory that SS scans. When I turn off my PC, then turn off the external, reboot, repower the external, all the links to music stored on the external, are broken. All links to music that is stored on internal drives, are fine.

I can play all my files, both stored internally or externally fine.

Seems really weird to me.

Did I explain that any better?

Thanks for the reply.

mgh
2007-07-01, 19:15
I have been experimenting, and made some progress. Using LinuxMint.

If I right-click and unmount the external drive before turning off the PC, everything stays good, no broken links.

With Ubuntu I was not always able to unmount by right-clicking. With LinuxMint, I occasionally get two different desktop icons for the same external drive. When that happens I am out of luck, nothing to do but reboot and hope for the best.

Thanks

snarlydwarf
2007-07-01, 19:58
Right, Linux (and Windows for that matter), like to buffer disk writes. They save them up for a while and write when they have to, or when "too much time" has gone by... Since disk activity tends to cluster (lots of updates to nearby blocks at once), buffering speeds up access a ton (that is the scientific measure...).

On Windows there is a thing to remove removable media that you should use whenever you swap drives or memory cards or whatever to politely request that those buffers get written. On Linux, and unmount does mostly the same thing (unfortunately it doesn't guarantee that USB media gets written... in practice it seems to always work, but I am paranoid and make sure to wait a few seconds between the unmount and actually powering-down the drive).

Mark Lanctot
2007-07-01, 20:18
I have been experimenting, and made some progress. Using LinuxMint.

If I right-click and unmount the external drive before turning off the PC, everything stays good, no broken links.

With Ubuntu I was not always able to unmount by right-clicking. With LinuxMint, I occasionally get two different desktop icons for the same external drive. When that happens I am out of luck, nothing to do but reboot and hope for the best.

Thanks

So it appears if you unmount nicely everything's OK then?

I presume that when you forcibly unmount, the OS still thinks the files are there and tries to follow the links. When it can't find anything, it invalidates the links. If the OS knows the drive has been unmounted, it knows not to follow the links.

Incidentally, in Ubuntu 7.04, you can't unmount a drive by right-clicking. In addition to cut/copy/paste/properties etc, you get "Eject", which doesn't do anything. You have to type "sudo umount /dev/" and the drive numbers, in my case sda1 and sda2.

4mula1
2007-07-02, 04:56
This could be a good time to look into using automount. In a nutshell, automount will mount/unmount a device (local or network) as needed. You specify an inactivity timeout and when this time has elapsed the device is unmounted. When something requests data from the device it is mounted, until the inactivty timeout elapses.

I have it setup on my Solaris box for both my NSLU2 (Unslung with nfsd) and my XP box (add-on nfs daemon). Works like a champ and it solved my issues with the nfs link being broken when the XP box was rebooted.

mgh
2007-07-02, 17:20
Yes, so far it appears that when I unmount nicely there is no issue.

You understand I am not just turning off the external? I am waiting for the PC to power off, then turning off the external. What you say does make sense, just don't understand why it is an issue when I am waiting to turn off the power (but hey, there are many things I don't understand about computing)

I an very new to Linux, was using Ubuntu, now using LinuxMint (and loving it, though I sorely miss the Ubuntu DE). Anyway, a search in synaptic for automount turns up something called "autofs", with this description:

kernel-based automounter for Linux
Autofs controls the operation of the automount daemons. The
automount daemons automatically mount filesystems when they
are used and unmount them after a period of inactivity. This
is done based on a set of pre-configured maps.

The kernel automounter implements an almost complete SunOS
style automounter under Linux. Automounter version 4
(autofs4) has to be enabled when compiling the kernel.
Debian packaged kernels have it enabled.

This is what you are referring to? Is it something I configure once it is installed?

Thanks for the replies.

4mula1
2007-07-03, 03:13
That's it, but I don't know if it's been compiled in your kernel. I run Solaris so I'm not too much help in configuring it on Linux. I do know that if you Google for "Linux automount" you'll find several resources that can help you. I did much the same for Solaris.

mgh
2007-07-04, 14:47
OK, today I forgot to unmount this same external ntfs when shutting down LinuxMint. As I am cursing myself, just before the screen went blank, up pops a window saying something like: "unmounting volume".

Well guess what, I reboot, and have no broken links. Keep in mind I have not made any changes to the system, it just decided to safely unmount it automatically.

I am enjoying my experience with Linux, but these things can drive a guy nuts (or more so).