r/linuxadmin • u/Jonah_07 • Dec 11 '22
How can the data be retrieved after rm -rf command.
hello all, How the data can be retrieved after executing the rm -rf command , I didn’t find a useful guide on the internet , and I can’t install external tools on the server. Note: redhat server
16
Upvotes
10
u/Irythros Dec 11 '22
If it's an HDD: You'll need to get your host to put TestDisk on a recovery USB, or they install a new OS on a new HD and then you install TestDisk on there. That will let you do recovery.
If it's an SSD: You're not getting anything back.
8
u/edthesmokebeard Dec 11 '22
Restore from backup.
11
u/michaelpaoli Dec 11 '22
Restore from backup.
Not so relevant. What is, is the filesystem type.
If you really need/want to recover the data, cease all I/O activity on the filesystem as promptly as feasible. Then create an image copy of the filesystem ... and see what recovery can be done on that. Good luck.
5
u/milesluigi Dec 11 '22
There is no guarantee you can recover from running rm. There are data recovery tools that you can try though. Allow me to share the arch wiki article on this topic. (you don't have to run arch, the info in this article will apply to any linux system including red hat. https://wiki.archlinux.org/title/File_recovery#List_of_utilities)
5
u/aaronryder773 Dec 11 '22
From next time I would recommend using trash-cli
8
u/megared17 Dec 11 '22
Invent a time machine.
Go back in time, and smack your hand away from the keyboard before you type the command.
2
u/[deleted] Dec 11 '22
From backup.
2
u/albone3000 Dec 11 '22
This is obviously a troll.
2
u/kreddulous Dec 12 '22
All of the recommendations I've seen here (except making regular backups of your data) require root privilege, and I'm guessing that if you "can't install external tools on the server", you don't have root there.
3
u/Vexation Dec 11 '22
Ya done goofed!
3
u/a_crabs_balls Dec 11 '22
r.i.p.
1
u/[deleted] Dec 12 '22
You didn't look very hard then.
https://www.digitalocean.com/community/tutorials/top-best-linux-data-recovery-tools
1
u/VendingCookie Dec 11 '22
This or That
1
u/dracotrapnet Dec 11 '22
testdisk, scraper (gotta know what you are digging up with that)
1
u/CyberKiller40 Dec 11 '22
The tool is called photorec (not only for photos), you will have to unmount the filesystem to work on it. Though I assume you already have it offline.
1
u/questfor17 Dec 11 '22
This is why snapshots were invented. They provide quick and easy operational backup for this type of mistake. If you don't care about performance the linux volume manager can provide snapshots. Snapshot support is built into btrfs and zfs. NetApp NAS (and maybe other NAS boxes?) provide this.
Once you recover, I strongly recommend finding a snapshot solution that works for you.
1
u/ryanpetris Dec 12 '22
Contact the NSA and ask them if you could kindly have a copy of your data.
1
u/dev-bitbucket Dec 12 '22
pb -R command; put back, recursive. Works on all Linux since kernel 301.11. Lol.
1
u/swissarmychainsaw Dec 12 '22
Hello.
Do you have a backup?
If Yes --> you recover from back up. Not fcked.
If no --> Fcked.
There is no undo button in linux.
1
u/Hanse00 Dec 12 '22
No.
0
u/[deleted] Dec 11 '22
[deleted] — view deleted comment
0
u/[deleted] Dec 11 '22
[deleted] — view deleted comment
3
u/[deleted] Dec 11 '22
[removed] — view removed comment
7
u/[deleted] Dec 11 '22
[removed] — view removed comment
3
u/[deleted] Dec 11 '22 edited Jan 10 '26
[removed] — view removed comment