meanwhile, me getting annoyed that a network mount whose endpoint is not available anymore just completely refuses to unmount, no matter what I do
linuxmemes
Hint: :q!
Sister communities:
Community rules (click to expand)
1. Follow the site-wide rules
- Instance-wide TOS: https://legal.lemmy.world/tos/
- Lemmy code of conduct: https://join-lemmy.org/docs/code_of_conduct.html
2. Be civil
- Understand the difference between a joke and an insult.
- Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
- Don't get baited into back-and-forth insults. We are not animals.
- Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
- Bigotry will not be tolerated.
3. Post Linux-related content
- Including Unix and BSD.
- Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of
sudoin Windows. - No porn, no politics, no trolling or ragebaiting.
- Don't come looking for advice, this is not the right community.
4. No recent reposts
- Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
5. π¬π§ Language/ΡΠ·ΡΠΊ/Sprache
- This is primarily an English-speaking community. π¬π§π¦πΊπΊπΈ
- Comments written in other languages are allowed.
- The substance of a post should be comprehensible for people who only speak English.
- Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
6. (NEW!) Regarding public figures
We all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations. - Keep discussions polite and free of disparagement.
- We are never in possession of all of the facts. Defamatory comments will not be tolerated.
- Discussions that get too heated will be locked and offending comments removed. Β
Please report posts and comments that break these rules!
Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.
You can lazy umount, which blocks new accesses and actually unmounts when it can
Yep. The lock comes from files being opened on the mounted path. Remove those and you should be fine.
Who is using my file?
lsof path/to/file
You almost always want to pair lsof with -n, as by default, it (slowly) lists a bunch of things that require name resolution.
$ time lsof >/dev/null
real 2m12.352s
user 0m0.499s
sys 0m1.217s
$ time lsof -n >/dev/null
real 0m1.600s
user 0m0.523s
sys 0m1.029s
$
Well actshly, rm removes the inode, not the file. If it's still in use it'll stay on the disk until the last fd is closed.
- with most file systems that are usual on linux
You can also still access the file as long as there's a process that still has it open. I have, in the past, "undeleted" a file or two doing that.
$ echo foo > bar
$ tail -f bar
foo
In another terminal:
$ pidof tail
1525534
$ ls -l /proc/1525534/fd|grep bar
lr-x------ 1 tal tal 64 Jun 16 06:42 3 -> /home/tal/bar
$ rm bar
$ ls -l /proc/1525534/fd|grep bar
lr-x------ 1 tal tal 64 Jun 16 06:42 3 -> /home/tal/bar (deleted)
$ cat /proc/1525534/fd/3
foo
$ cat /proc/1525534/fd/3 > bar-recovered
$ cat bar-recovered
foo
$
That is, the /proc entry for tail's file descriptor 3 there looks kinda like a symlink, but the kernel doesn't actually make it behave in quite the same way as a normal symlink.
That being said, getting back to the original point about unlinking not being able to remove the directory entry...it won't sit there blocking you from putting a new directory entry there with the same name, the way Windows file semantics mandate.
Yep, it's a smart system.
For the user, the file is immediately no longer in the tree, so for them it's considered done.
The OS should handle all the hassle, not the user.
I think "consider it done" puts it well.
"I'll get to it, eventually" would ruin the meme but be more fitting, in my opinion.
Had multiple occasions where people fought against filling disks and just couldn't see why. Well, that 10 gig log file you deleted two weeks ago? It's 20 gig now, and still being written to.
lsof shows stuff like that.
Nothing new can open it immediately.
So it's effectively deleted with old references slowly phasing out.
Zombie files are an issue though. A while back I had a huge zombie file on a tmpfs which was filling all my ram. So I built a tool to track it down and traced it to a konsole instance with a killed tab that previously had billions of lines of stdout history.
https://github.com/redjard/zombie-file-list
zombie-file-list
Lists Linux files that are still opened in a process but were deleted. These "zombie files" use up space and inodes but are hard to find.
I wrote this because my /tmp tmpfs was taking up 32GB of ram despite the files inside summing to only 3MB.
Usage:
zombie-file-list <path to filesystem>Note:
- This command is designed to be run on filesystem roots, not paths in general.
- Sizes are apparent sizes, e.g. on ext4 the actual sizes are rounded up to the next 4KiB
I wrote this because my /tmp tmpfs was taking up 32GB of ram despite the files inside summing to only 3MB.
Note that tmpfs doesn't force its contents to remain in memory
the kernel can move stuff there to swap space if it needs to do so.
Ramfs is the filesystem that keeps things locked in memory:
https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt
With ramfs, there is no backing store. Files written into ramfs allocate
dentries and page cache as usual, but there's nowhere to write them to.
This means the pages are never marked clean, so they can't be freed by the
VM when it's looking to recycle memory.
Maybe. It's been a while so I don't know 100% this was put to the test, but I wanna say the system has a weird kernel which leads to it not swapping out tmpfs properly.
But ordinarily you should be right, this would simply ruin the stats visually until something forced it to swap out, since konsole shouldn't be accessing it.
Could you have restarted to allow the OS to clean it up?
I could have, but the system wasn't set up to restart without downtime, and the server was also remote and not easily accessible.
It did acutally die due to a poweroutage some months later and took 2 days to get restarted.
So yeah sometimes restarting is way more undesirable than loosing access to 32GB of ram. I would have just eaten that cost otherwise until a more opportune chance to restart.
Besides, restarting to fix a problem is equivalent to giving up on understanding the issue, learning new stuff, and maybe finding a way better solution or preventing the type of error entirely.
I get not finding the motivation when your software is working against you and learning is ultimately fruitless like on windows, or not having the time in the moment to figure it out properly, but a perfectly good bug on a linux system when you have time is prime real-estate to grow your skills and find fulfillment.
Ah that makes sense. I had considered it might be a server but you mentioned a Konsole tab so my mind decided it must have been local machine.
Crazy it took 2 days to restart the server!
There was a dedicated person on call, but it happened to be when they were away.
The Konsole was left running from a local access, with a while true loop of a service status command. When that service was stopped later, the while loop started rerunning the script every second, filling the buffer with error messages.
The tab was then killed remotely, but the Konsole window left running. Process ram usage went down but the file remained on tmpfs, which is not counted as ram usage so wasn't noticed.
Then it took some time to notice the ram usage mismatch so noone thought of that konsole incident.
Do modern file systems actually remove it from disk? It's been a while since I did any forensics and didn't do much of it, but I remember being able to batch restore files from inodes as long as that part of the disk hadn't been overwritten. That's why you're supposed to overwrite disks with random data if you want to data gone.
Nah, they just throw away the block markings, absolutely.
Overwriting a SSD is difficult as well, better encrypt the drive and trash the key when you decommission.
What about microwaving it?
You mean like in your kitchen? Too much metal, you'll damage your magnetron.
You could use thermite and melt it to a pulp. Dangerous as well, though.
Really, just encrypt. Your CPU has AES extensions, performance impact is negligible. Simple, clean, and a protection against involuntary decommission as well.
If the file is on an SSD and trim is enabled, the blocks will be erased eventually.
Interesting TIL
At some point macOS introduced a bug that ejecting a usb drive that is open in the file viewer used to eject it doesnβt work
I wanted to remove an Adobe file because it wouldn't let me uninstall Adobe through the program management. It said it was being used. By explorer apparently. Checked online, all I had to do was rename the file, then delete it. Worked. But it's so dumb.
Btw this also method to prevent file/dir be automatic created: for dir make file with same name, for file other way.
Usually rename only replace other file, not dir. And if path exist but file, cannot open as dir, but also not create.
This was how you could prevent Cortana and some other stuff from being automatically reinstalled when Windows forced if. Uninstall the app via appx, or just delete the folder instead if it's not in use, and then replace it with a file with the same name so it can't remake the folder.
Cortana being reinstalled after I "deleted" it was the impetus for me to swap to Linux in the first place.
That and I was a CS student and our assignments had to run on Solaris which is closer to Linux than Windows.
Northern Scandinavia??
You used Solaris when cortana was already a thing? That's great! :D
My university ditched Solaris like 20 years ago. Still have fond memories of cde lol
Windows being portrayed as a polite UwU in ΓΎis meme has always seemed off, to me. I imagine it as more surly and petulant.
I imagine it more as a condescending IT guy who isn't actually very good at his job and has secretly set up each machine to spy on the users (but again isn't very good at what he does so it isn't much of a secret).
Where did I read that the ΓΎ character doesn't really help against AI at this point? That it is pretty futile? Can't remember.
I imagine it as more surly and petulant.
No, that's macOS