Forum › Forums › New users › New Users and General Questions › Seeking help with UNdeleting a directory
- This topic has 42 replies, 11 voices, and was last updated Sep 25-1:42 am by stevesr0.
-
AuthorPosts
-
September 19, 2022 at 1:28 pm #89319Member
stevesr0
Hi all,
I hit the delete “button” while hovering over my Documents directory.Haven’t done this in a long time, so I looked at how to undelete. Messed around with testdisk and photorec, realized that I was not doing this safely (not running a read only system to prevent ongoing changes) and stopped last night. (Testdisk apparently doesn’t work on ext4 systems?)
Looked around on another machine and found extundelete, which seems as if it might “simply” undelete my Documents directory at one blow.
But I figure one of you folks might have (unfortunately) a lot of knowhow.
So, before I further mess with it, I would appreciate your advice.Thanks in advance.
stevesr0
September 19, 2022 at 1:58 pm #89321Moderator
Brian Masinick
::@stevesr0: You MAY get “lucky” and have success “undeleting” files and directories if there are “dangling” inode references to items that have been “deleted”, but not physically replaced on the disk, but this is NOT a reliable way of getting back old files and directories. It ONLY works IFF – (that’s IF and only IF) none of the references (inodes) to the files/directories point to disk blocks that still exist, and have not been overwritten.
The only truly reliable way to get files back is to be fairly consistent in creating backups of files and directories. These days there are a LOT of ways to do that besides the old “classic” way of creating tape back-ups. I personally use Cloud-based stuff often, or copies of the same files and directories on USB Flash Drives, external drives of other types, copies on other systems, etc. I’ve long been following a practice of having copies of things I care about in DIFFERENT places, with the idea that no one single source will always ensure the ability to get them back.
Most of the stuff I keep is configuration-related stuff like hidden config files, backgrounds I like, etc. Most of my Email is kept in freely available services. While SOME personal information is available in some of these places, the most sensitive of my personally available information is reasonably protected on authenticated servers and tends to be only in places that have at least a “reasonable” degree of protection, though I’m not paranoid about such things.
Over the years, believe it or not, the worst compromises of my information have come through local, physical grocery store or similar establishments, and my financial institutions have always caught and protected me from the intrusions or loss of either funds or privacy, typically either changing cards or authentication, at no cost; I can live with that.
--
Brian MasinickSeptember 19, 2022 at 7:24 pm #89345Memberstevesr0
::Hi Brian M,
Thanks for response.
Probably good for this thread to be retitled “WARNING – Don’t let this happen to you!!” Might be valuable as a tickler for other noobies with bad habits.
Of course you are absolutely correct that computers are storing highly volatile stuff and may remove any traces of what was deleted very quickly.
In fact (which I just learned about), SSD drives commonly use a thing called TRIM, which results in immediate – and I understand permanent and irretrievable – loss of information.
Having said this, I will still check to see if I can retrieve some of the files (always optimistic <g>), and start better backing up…
stevesr0
September 19, 2022 at 8:19 pm #89355Moderator
Brian Masinick
::Yeah, anything, whether on SSD or on other media, if the trim feature is used, you’re right, what it does is clean out those inode references, thereby making those undelete capabilities unavailable and unusable. So yes, in theory sometimes you CAN take advantage of inode references that are not immediately removed, but if you rely on that feature, it’s not a great or reliable strategy; a better strategy is to somehow keep multiple copies of things in multiple places and on multiple different types of media, such as USB, different systems, cloud storage, explicit backup, at least two or more of these or other creative, but reliable ways to bring the information back if it’s lost or accidentally removed. There are numerous ways to do it; the important take away is to always use at least one, preferably two or more of the available methods, then when surprises, mistakes, hardware failures, or the unknown happens, there’s two or more ways to get it back!
--
Brian MasinickSeptember 19, 2022 at 8:37 pm #89357MemberPPC
::I created a transformation pack for antiX (available in the repo)- FT10 – that has zzzfm configured to use a trash can by default… maybe it can be useful for you in the future, to stop this can of thing from happening…
P.
September 19, 2022 at 9:16 pm #89361Memberstevesr0
::Hi PPC,
Yes, that would be perfect. I found on line a site at University of Stuttgart which houses a suite of command line tools called fstools. One of the tools is a “del” command which supports undeleting. I assume that this means that the automatic immediate deleting that SSDs with TRIM enabled do doesn’t occur.
And I assume that is also a feature of your trash can.
I look at the description – it doesn’t mention a trash can (ft10-transformation package)?
Thanks for response. That is helpful.
stevesr0
- This reply was modified 7 months, 2 weeks ago by stevesr0.
September 19, 2022 at 9:44 pm #89364Member
marcelocripe
September 20, 2022 at 1:03 am #89369Memberstevesr0
::Hi marcelocripe and PPC,
Thanks for the link.
I just skipped through all the trash can references on that 22 page thread, and watched BobC’s video.
Very neat for people who came from Windows and would like a familiar environment.
I just did a new install on one of my computers of antiX-21 and I use zzzfm as the file manager. Tomorrow, I will see about adding the trashcan to it.
I installed the trash-cli package on my minimalistic Sid install. It has an Openbox graphic interface and uses spacefm as the file manager (installed from the antiX-19 net). I don’t imagine trash-cli will work with it instead of zzzfm, so I just installed zzzfm also. Looks identical to spacefm. By default, file options include “Delete”, so I guess that the recycle/trash option still isn’t the default (I am sure in one of the posts it says this, but I am trying to absorb this in one gulp and I am getting heartburn.
So, hopeful that in the next day or so, I will have that working so I no can stop focusing on accidental deletions and more on setting up backup <g>.
Thanks for all your work in producing this and pointing it out to (oblivious) me.
One question – I installed trash-cli and looked for the folder ~/.local/trash/ or ~/.local/Trash/ and don’t see it. What is the name of the folder that holds the trashed files?
stevesr0
September 20, 2022 at 3:40 pm #89392Moderator
Brian Masinick
::Typical “trash can” implementations do not immediately delete files, they move them to a different location; there the actual files are either deleted by running the procedure to “empty the trash can”, and some trash can tools will eventually empty the trash can for you after a specified period of time. The “empty the trash can” feature may be available in some implementations and other implementations may still require you to “take out the trash and have it emptied”. 🙂
--
Brian MasinickSeptember 20, 2022 at 3:40 pm #89393Member
techore
::@stevesr0, food for thought.
In addition to a mv to a trashcan then delete later, you may want to supplement the trashcan using btrfs.
btrfs snapshots are not a replacement for backups but they are great for recovering accidentally deleted files. I would recommend setting a daily job or any period of time you are comfortable with data loss. For example, recovering @home from a daily snapshot means any new data after the snapshot will be lost. For my purposes, I believe it to be an acceptable loss but your needs may differ.
https://btrfs.readthedocs.io/en/latest/Introduction.html
http://snapper.io/September 20, 2022 at 3:48 pm #89395Memberolsztyn
::btrfs snapshots are not a replacement for backups but they are great for recovering accidentally deleted files.
Very interesting… I have been using btrfs for antiX but never paid attention to recovery feature. I am curious of your experience, such as easiness of use of snapshots in practice.
Live antiX Boot Options (Previously posted by Xecure):
https://antixlinuxfan.miraheze.org/wiki/Table_of_antiX_Boot_ParametersSeptember 20, 2022 at 4:13 pm #89401Memberstevesr0
::Added translation to Brazilian Portugese of my previous post (#89369)
————————————————————————-
Oi marcelocripe e PPC,Obrigado pelo link. Eu só pulei todas as referências de latas de lixo naquele segmento de 22 páginas, e assisti ao vídeo do BobC. Muito legal para pessoas que vieram do Windows e gostariam de um ambiente familiar. Acabei de fazer uma nova instalação em um dos meus computadores de antiX-21 e uso zzzfm como gerente de arquivos. Amanhã, vou ver sobre adicionar a lata de lixo a ele. Instalei o pacote trash-cli na minha instalação minimalista sid. Ele tem uma interface gráfica Openbox e usa o spacefm como gerenciador de arquivos (instalado a partir da rede antiX-19). Eu não acho que o trash-cli vai trabalhar com ele em vez de zzzfm, então eu acabei de instalar zzzfm também. Parece idêntico ao SpaceFM. Por padrão, as opções de arquivo incluem “Delete”, então eu acho que a opção de reciclagem/lixo ainda não é o padrão (tenho certeza em um dos posts que diz isso, mas estou tentando absorver isso em um gole e estou ficando com azia.
Então, esperançoso de que nos próximos dias ou assim, eu vou ter que trabalhar para que eu não possa parar de focar em exclusões acidentais e mais na configuração de backup. Obrigado por todo o seu trabalho em produzir isso e apontá-lo para mim (alheio). Uma pergunta – instalei o trash-cli e procurei a pasta ~/.local/trash/ ou ~/.local/Trash/ e não vejo. Qual é o nome da pasta que contém os arquivos destruídos?
stevesr0
September 20, 2022 at 4:25 pm #89403Memberstevesr0
::Hi Brian M,
The trash can is what I want in my declining years to reduce chances of more accidental losses. Even tho the core technique is save everything you care about to a separate device from the one you are using and ideally to a place at a distance from the devices you are using, until I have hourly backups, I still am at risk of losing something by an errant button push.
Plus, it is something that (hopefully) I can try out immediately, while I am in process of setting up backups.
Hi Techore,
I have to look into btrfs and its snapshots. I will report back…
Hi olsztyn,
I look forward to read what your impressions are of the backup tools of btrfs.
Thanks to all of you for enlightening me and continuing this interesting conversation.
stevesr0
September 20, 2022 at 4:32 pm #89405Moderator
Brian Masinick
::Looking at rox-filer and zzzFM, I don’t notice the trash icon; I will tell you that desktop environment file managers, such as Konqueror (KDE) and Thunar (Xfce) do offer trash can icon capability. Can’t recall at the moment which other file managers have this; if I happen to spot one when I visit a few of my other distros, I’ll try to remember to come back and mention them to you.
--
Brian MasinickSeptember 20, 2022 at 5:46 pm #89411Moderator
Brian Masinick
::I booted into one of my distributions that has Thunar as one of the file managers, and sure enough, Thunar DOES have a trash can with the capability to put stuff into it, and until you EMPTY the trash, the contents remain. Moreover, there is a nice feature to “Restore Selected Items”, provided you do so BEFORE you empty the trash.
Anyway, I think this kind of tool is helpful. It won’t save you if you do empty the trash, but if you do that only occasionally, (once a day, once a week, whatever suits your style), if you realize you need something, you simply mark the contents you want to keep, and then click to “Restore Selected Items”, and they are restored to their previous location.
Thunar, as I’ve mentioned before, is part of the Xfce desktop environment. To me, it’s lighter than either KDE or GNOME. It uses the same toolkit as GNOME, the toolkits in the Gtk+ family; most tools I believe are Gtk+3 at this point (haven’t seen a “4”, but maybe it’s nearby). Anyway, this is the one I’d pick if you need more than what rox-filer or zzzFM offer.
--
Brian Masinick -
AuthorPosts
- You must be logged in to reply to this topic.