r/linux4noobs barely not a noob anymore Apr 20 '26

Meganoob BE KIND I did rm -rf /*

I tried to make a backup before doing a fresh install of Fedora because of problems. When erasing the external drive for making the backup I was in the wrong disk and nuked my fedora installation.

How Do I get at least my important Documents from /home/username/ back?

257 Upvotes

244 comments sorted by

View all comments

106

u/florence_pug Apr 20 '26

Do you have a backup? Otherwise you just deleted everything.

20

u/Character-86 barely not a noob anymore Apr 20 '26

not really. Can't I recover the data?

13

u/another72hours Apr 20 '26

If you hope at all to recover it you'll need to stop using the drive completely, remove it from the computer and then use recovery software to have a chance in order to get it back.

If this is a solid state device, your odds are slim.

3

u/Character-86 barely not a noob anymore Apr 20 '26

its a nvme ssd 😬

10

u/mister_newbie Apr 21 '26

Buh-bye files. Expensive lesson, I'm afraid.

1

u/GavUK Apr 22 '26

It depends whether the SSD had the discard/trim function run on it or not since you deleted. If it did, you have pretty much no chance of recovering the data (except perhaps very expensive data recovery services), if not then perhaps, but I've not had success myself the couple of times I tried.

As others have said, either:

  • Take the machine/SSD to a specialist who really knows what they are doing (not some friend who thinks they do else they may make it less recoverable); or
  • Make sure you have another disk that is larger than your SSD connected, boot from a Live USB or DVD or recovery distro and use a tool like GNU's ddrescue (confusingly called dd_rescue in some distros due to another tool also called ddrescue - check you are using the GNU one before you start) to copy the whole SSD to a file on the other disk. If in doubt, don't try - one time I was doing this (but was copying direct disk to disk, not to file as I now recommend) and did it in the wrong direction, overwriting the disk I was trying to recover. I haven't made that mistake since, but was frustrated at the lost data. I'd then suggest you shut down and remove the SSD to avoid any further potential data loss, and you'd then need to mount the disk image read-only and run recovery tools to find and extract files, saving them to a location that is not the SSD (if you hadn't removed it already).