I have an external hard drive, Western Digital 500GB (USB cable) that I recently divided into two equal partitions. When I plug it in, both partitions show up as drives in File Manager. However after a week or ten days I find that the two partitions are no longer mounted. This has happened twice. If I then unplug the drive and reconnect it, the two partitions automatically mount again. What causes them to get unmounted? Can it be that a re-boot does not re-mount them? It used to be OK when that drive was not partitioned, or had one partition (I don’t know which it was).
You come up with some tough ones.
Mounting of usb drives is controlled by udev… you dont put them in /etc/fstab
They are supposed to automatically mount when you plug them into a running system… but I find that is not always the case. Sometimes I have to cold boot to get mine to mount. Not sure if reboot works, I always cold boot, and that akways works.
Now you are telling us they sometimes unmount.
I am not sure if a reboot would do that… Best way to find out is to test it on your system
udev is a daemon. Try
ps ax | grep udev and you will see it running. If it stopped , things might unmount… but why would it stop?
One thing that can mess up mounts is things getting out of order in a boot sequence. I am not sure when udev starts in the boot sequence, but if it starts very early, a warm boot might miss it.
That is about all I can think of. Test the warm boot idea. Make sure the usb cable isnt dodgy. Do a smart test on your disk…
If the USB attached disks are spinning disks maybe they go into a power save mode after some amount of time and become unmounted?
@nevj @pdecker Thanks for the inputs. I will do some tests and get more detail on this. I want see if it is a problem only with this one drive, and / or whether it is only with USB drives that are partitioned, or only with ‘mechanical’ USB drives that are partitioned, or with one of my computers and not others, or restart versus power down, or udev, etc. etc. Lots of variables here! I will post an update.
I would go with the answer of the external drives going to sleep over time so not being available unlike usb drives. Switching them off and back on should help.
Thats a good plan Jim.
If you can narrow down the details, we may be able to arrive ar a fix.
I have another machine that runs Ubuntu, and usually external drives get mounted to /media/username/UUID when you plug them in instead of /mnt. So while I’m not sure about other distros, this is what definitely works for me in Ubuntu 23.04 :
1.) In File Explorer, right click on the external drive and select “Properties”.
2.) When that comes up you’ll see an option “Open in Disks” - Click on that.
3.) Click the icon that looks like a gear in the middle underneath the partition information and select “Edit Mount Options”
4.) More than likely, “User Session Defaults” will be switched on. Switch that off, and that will enable you to check the box that says “Mount at system startup”
5.) You’ll likely have to do this for both partitions, but the result will be that when you start up the computer, it’ll automatically mount, and I believe it’ll actually put an entry in /etc/fstab for you.
@Doron_Beit-Halahmi Thank you for this information. I’m giving it a try. However, the problem seems to have gone away after I changed computers (still Ubuntu 23.04) and in the process re-connected both ends of the USB cable to the external drive. Unless the problem comes back, I won’t be able to identify the root cause. The two partitions have been re-mounting automatically after both reboots and power downs.