You are not logged in.
Pages: 1
Scenario: I had an iso that I mounted (it's a video) and set to lay via vlc. No audio (which I was kind of expecting - there were some issues when I created the iso), so I deleted the image - completely.
Then I realised, my speakers were turned off (Doh!) and so the iso may have been fine, anyway.
It occurred to me that I hadn't unmounted the iso before deleting it. A quick trip into /mnt/iso and the filestructure was there. Opened vlc to play the mounted iso, and it plays.
Now here's the rub, since I deleted the iso image, where the hell is the mounted directory finding the files?
Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703
/ is the root of all problems.
Offline
Not sure I follow - you found the files in /mnt/iso, but you want to know where the files are? They're in /mnt/iso.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I know, but /mnt/iso is just a mount point for ~/mydisk.iso
mydisk.iso has been deleted, so /mnt/iso should be pointing nowhere.
Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703
/ is the root of all problems.
Offline
Ah, sorry, I see. I guess that is interesting. Two possibilities I see - which are just guesses:
1) does mount create a copy of the data? (I doubt it)
2) Is the data still in place at it's original location? (I suspect). To test this, if you didn't mind loosing the video, you could overwrite where the iso "used to be" with other data. When you delete the iso - or any file for that matter - unless you use some sort of secure wiping procedure, the data all still stays where it is, only the entry in the file table is removed.
Again, just guesses, I'm sure someone will stop in who knows how mount really works.
I'm thinking in C terms: if you create two pointers, allocate and fill a block of memory for one of them, then set the second equal to the first, then change the first (to point somewhere else - analogous to deleting here) then the second pointer still points to the filled data block. AFAIK filenames are much like pointers in this respect. If mount creates new "pointers" to the data in the iso, then the original "pointer" (aka filename) to the iso is deleted, the mount-created pointers will still point to that data until it is overwritten by something else. In fact, I'm not sure you could overwrite it with something else until the mount-created "pointers" (files) are unmounted freeing that data space. Bear in mind this is all speculation informed only by analogy to C pointers.
Last edited by Trilby (2012-07-17 13:32:01)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Well, it's got me stumped. Not that I'm complaining - it's the easiest file recovery I've ever done. I simply copied the files from /mnt/iso to a new location, then unmounted the defunct iso.
My personal best guess is that the delete isn't completed until the disk is unmounted, but I must admit to being flumoxed by this strange magic. 20 years of Linux and I never knew that this happened, whatever the cause.
Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703
/ is the root of all problems.
Offline
Well, sounds like standard Linux behavior: when you delete an open file, the data remains "marked in-use" on disk as long as it's open. Only once it's closed will that space be made available again. E.g. if you remove a video file you're playing in VLC, the data will remain there as long as VLC doesn't close the file. So only when you umounted it, did it "really" get removed from the disk.
If your iso file had been open by a "regular" process, you could have gone and looked in the corresponding /proc/xxxx/fd folder to actually access the file. That way, even though it doesn't have a name anymore, you could have copied it as usual.
You can try by copying a file (to be safe), openning it in e.g. vlc, pausing (so it remains open), deleting the file, then do something like:
ls -l /proc/$(pidof vlc)/fdYou should see a symlink to the deleted file, and you can then use that to e.g. copy the file back somewhere.
I have to say, though, that I'm not sure how that works in this case, where the file was opened & mounted as loop device... I'm not sure which process to look into for the open inode/link.
Offline
No, it's clearly expected behaviour to some extent, but somewhat undocumented.
As for copying, since the mount point still had the files, I was able to copy them in the usual way rather than having to jump through hoops to find them. Afterwards it was a trivial matter to recreate the iso from the original contents. certainly a lot more convenient than having to recreate the iso from scratch (personal project with myriad different source files).
Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Fractal Design Define 7 XL, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703
/ is the root of all problems.
Offline
When you delete a file, it's not actually gone. Only the link that points to it is gone, allowing the file to be overwritten.
Torrenting TV shows works the same. Try this: download an episode, open it in your favourite media player and then remove it (along with the data) from the torrent client while it's playing. You'll see that the episode will play until the end and after it's done, space will be freed. On Windows if you try to delete it while it's playing, you get something like "Cannot delete file: It is being used by another person or program".
I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).
Offline
I have made a little script that shows all currently deleted but still open files owned by the current user, code below:
#!/bin/bash
lsof -n -s -u $(whoami) | awk 'BEGIN { printf("%-9s %-20s %s\n","COMMAND","HANDLE","FILE") } $10 ~ "(deleted)" { sub("[uwr]","",$4); fd="/proc/"$2"/fd/"$4 ;printf("%-9s %-20s %s\n",$1,fd,$9) }'This could be tweaked to use 'column' instead of hardcoding lengths with the printf.
R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K
Offline
Pages: 1