27
submitted 4 months ago by EvilCartyen@feddit.dk to c/linux@lemmy.ml

I have very little experience with linux, so maybe this is a dumb question :)

I run Ubuntu 24.04 on a machine, and I had an old HDD in a usb-case which I mounted using fstab. Worked fine, but I decided it wasn't appropriate for my purpose and removed it (physically and from fstab).

But it still shows up in the file manager? What am I missing?

all 29 comments
sorted by: hot top controversial new old
[-] abominable_panda@lemmy.world 13 points 4 months ago

I could be wrong but I thought fstab only runs those commands on boot? If so you'll need to manually unmount using "umount" for now. It shouldnt be there next reboot

[-] EvilCartyen@feddit.dk 7 points 4 months ago

Well, I just rebooted and it's still there, which is what is confusing me :) But thanks!

So I should unmount it in other ways too?

[-] abominable_panda@lemmy.world 6 points 4 months ago* (last edited 4 months ago)

Are you saying the drive still shows up on the side as ejectable? Or the mount directory is still there?

If the latter what directory is it mounted to? May just be as simple as deleting that directory if its empty. (Assuming its like /media/xxx/ or /mnt/yyy/)

Check with lsblk command if anything is in those directories

[-] EvilCartyen@feddit.dk 3 points 4 months ago* (last edited 4 months ago)

It's mounted to /srv which is not empty, and I can also still browse some of the folders on the removed drive, which is also confusing :) I don't understand how that's even possible.

Edit: It does not show up as a drive, but the mount directory is still there with a folder structure and a single file.

Edit2: I deleted the folder which seems to have done the trick. Still confused about how and why it was still accessible......

[-] NeoNachtwaechter@lemmy.world 13 points 4 months ago* (last edited 4 months ago)

It's mounted to /srv

I suspect that your /srv had already existed before you mounted that drive for the very first time, and there were even some files in /srv.

The mounting of the drive has made these "old" /srv files invisible. But it has not deleted them. Now you unmounted the drive, and they have come back like Zombies :)

[-] communism@lemmy.ml 6 points 4 months ago

Does lsblk say it was mounted to /srv? If the drive doesn't show up in lsblk that means that /srv is non-empty and those files exist on whatever drive your root directory is on

[-] solrize@lemmy.world 5 points 4 months ago

Did you umount the file system before unplugging the drive?

[-] EvilCartyen@feddit.dk 2 points 4 months ago

I figured removing it from fstab was akin to unmounting it.

[-] solrize@lemmy.world 5 points 4 months ago

I don't think so. I guess it's sort of possible that it automagically does that but I haven't kept track. I just use umount(8).

[-] possiblylinux127@lemmy.zip 3 points 4 months ago

Definitely no

Hopefully it wasn't in use and doing that can cause issues. It probably not a big deal but next time hit the eject button.

[-] ScottE@lemm.ee 2 points 4 months ago

Nope, it doesn't work that way. You have to umount it. You could reboot after removing it from fstab, but that's a bigger hammer than necessary.

[-] vk6flab@lemmy.radio 5 points 4 months ago

Make sure that it's the one you think it is.

Also, how did you "remove" it? Just yank the cable, or something a little more refined like unmount or eject?

[-] EvilCartyen@feddit.dk 5 points 4 months ago

Yanked out the cable like a medieval surgeon ;) Anyway, since I removed it from fstab I figured it was unmounted.

[-] communism@lemmy.ml 9 points 4 months ago

fstab tells the system what to mount on boot; it doesnt live reload! In future to unmount something do:

sudo umount /path/to/mountpoint

This command also works for something in your fstab, because fstab is only relevant during boot.

[-] MentalEdge@sopuli.xyz 6 points 4 months ago* (last edited 4 months ago)

Don't do that.

fstab is just a config file so the computer knows what drives and storage volumes its supposed to have when it boots.

You can add and remove drives without ever editing fstab. Plugging something in should give you the option to mount it in your file explorer, and in the same place you should be able to "eject" it before disconnecting the actual cable.

[-] EvilCartyen@feddit.dk 5 points 4 months ago

Don’t do that.

Coming from non-linux, it's not usually a problem. But now I know better :)

fstab is just a config file so the computer knows what drives and storage volumes its supposed to have when it boots.

You can add and remove drives without ever editing fstab. Plugging something in should give you the option to mount it in your file explorer, and in the same place you should be able to “eject” it before disconnecting the actual cable.

I know that, but this particular drive was meant to be permanently mounted and accessible, which is why I added it to fstab. I am removing it because it's damaged and i have to replace it with something which isn't to act as a permanent drive for the server.

Thank you for your help :)

[-] MentalEdge@sopuli.xyz 1 points 4 months ago* (last edited 4 months ago)

It was always a problem. On all systems.

Filesystems are resilient, but one that is actually designed to reliably survive being physically disconnected without warning, does not exist.

Windows has always had a "make safe to unplug" button, too.

Not that it matters if you were discarding the drive.

[-] EvilCartyen@feddit.dk 0 points 4 months ago

I mean, yes. But on the other hand, I've removed usb-connected media without using that button thousands of times and never had an issue. I'm obviously not doing it when I am writing to or reading from the medium.

Either way, thanks again for taking the time to respond :)

[-] MentalEdge@sopuli.xyz 2 points 4 months ago

Yes, and every single time, it was because filesystems have ways to recover when things go wrong.

But make no mistake, things went wrong. Every time. Even if no files were damaged, the next system accessing the volume would run into a file system that wasn't exited properly.

And while "never do it while it's being accessed" improves your chances, due to write caching you can't actually know if the medium is still writing or reading. Or internally in the middle of a process organising data structures. Or being checked for damage by a background process because the filesystem was flagged for repair due to inconsistencies. Or in the case of spinning rust, in the middle of a background defrag. Or in the case of flash storage in the middle of a trim.

If you have a forgiving boss you could tell him "fuck you" to his face every morning... But why would you? Maybe one morning he'll be cranky, and that one time he'll take offence and actually fire you.

[-] EvilCartyen@feddit.dk 1 points 4 months ago

Point made :D

[-] just_another_person@lemmy.world 5 points 4 months ago

My guess is this is in GNOME? If there isn't an eject button next to the mount name, that's just a "favorites" link that got added, and not the actual mount. Right-click to remove it if you don't need it anymore.

[-] ElderWendigo@sh.itjust.works 1 points 4 months ago* (last edited 4 months ago)

With all due respect, RTFM. Mount and umount are two sides of the same operational coin. You mount the drive to use it and unmount it when you're done. fstab is just a file system table used to remember and consistently apply the options used whether you're mounting the drives manually or telling the system to do it at boot.

Deleting a line from fstab is not the same as unmounting, it is just a shortcut to tell the system how you want that drive mounted when you or the system run the mount command. Mount directories (usually the folders in /media/ or /mnt/ ) also do not get automatically deleted just because you "yanked the drive". Again, those directories are just where your system is expecting to mount the drive. When the drive is mounted they will be the root path to its contents, when the drive is unmounted they will be empty but they still exist. If your planning on mounting the drive again leave them there. If you're not planning on mounting them again, delete them.

If you're not planning on regularly mounting a particular drive, it probably shouldn't be listed in fstab and you should just run the mount command with the appropriate options (again fstab is just a table for remembering those options for the mount command).

Many desktop Linux distros are also capable of automatically mounting new removable drives in such a way that the user can access them and doesn't have to worry about touching fstab or the mount directories.

[-] EvilCartyen@feddit.dk 8 points 4 months ago

Thanks. I don't mind reading manuals at all, but is this not a community for asking questions?

[-] ElderWendigo@sh.itjust.works 0 points 4 months ago

For me at least, it's not that you're asking questions. I answered, so obviously I'm sympathetic to confusion in this area. I'm just trying to encourage you to seek your answers in the documentation and manuals FIRST. The way your question was worded led me to believe that you had not read the manuals at all and were simply copying snippets of code and commands from some random question and answer style forum that did not teach you anything about the fundamentals of what those commands and code actually did. That's fine too, lots of people started off that way, myself included. Reading the manuals gives you the context to step back and understand how those commands work and what they're really doing. If you do, you'll be much better able to troubleshoot your own problems, you'll be able to ask better questions in forums like this, and you'll get better and more useful responses.

[-] EvilCartyen@feddit.dk 3 points 4 months ago

Sure, I mean I am used to reading (and writing) manuals and documentation, so I usually go that route first when I know where to look. And your answer was helpful. Anyway, what are some authoritative ressources I should consult concerning these fundamental concepts?

[-] ElderWendigo@sh.itjust.works 0 points 4 months ago

Start with the man pages. Running the command man followed by a space and then followed by the command you're using will almost always give you a man page of the basics of how that command works. The fstab has its own man page too. An internet search "man fstab" or whatever command you're interested in should also net many mirrors of the those man pages as well.

this post was submitted on 08 Jul 2024
27 points (93.5% liked)

Linux

48317 readers
714 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS