91
votes
Accepted
Wrong mv command. Where did my files go?
Your directory is still there :)
You have renamed it ....
Because files whose names start with . are hidden, you cannot see the directory unless you display hidden files
run
ls -A
and there it ...
90
votes
Accepted
I've just "mv"ed a 49GB directory to a bad file path, is it possible to restore the original state of the files?
When moving files between filesystems, mv doesn't delete a file before it's finished copying it, and it processes files sequentially (I initially said it copies then deletes each file in turn, but ...
66
votes
What are the contents of /bin/bash, and what do I do if I accidentally overwrote them
Don't shut down your machine.
Do you still have a running shell? Is it bash? If so, you're fine. (But don't do this again.)
Run:
sudo cp /proc/$$/exe /bin/bash
Voila, all is well.
Since ...
51
votes
Recover deleted files on Linux
What worked for me was given by arch (only applies to text files):
grep -a -C 200 -F 'Unique string in text file' /dev/sdXN
where /dev/sdXN is the partition containing the lost file (check with ...
51
votes
Accidentally ran sudo rm /* on my Arch Linux installation
Arch Linux has four symbolic links in /:
bin -> usr/bin
lib -> usr/lib
lib64 -> usr/lib
sbin -> usr/bin
You should be able to recreate them (using a Live-USB or an emergency shell) or by ...
50
votes
Accepted
How can I change a file to a directory? Files lost after find+mv
Adding a slash at the end of the destination path /opt/alfresco/archived/2020-01-07 would have made the mv command error out, as the 2020-01-07 directory evidently does not exist. This would have ...
48
votes
Accepted
Best practice to continue mv
Forget about trying to reinvent rsync, and use rsync.
sudo rsync -av /location/to/drive1/ /location/to/drive2/
Make sure you use a trailing slash on the source, otherwise it would copy to /location/...
41
votes
Wrong mv command. Where did my files go?
The correct form would have been
mv folder_name ../..
You've moved your folder to a new folder named ....; to recover your files, run
mv .... folder_name
Like many other commands, mv is somewhat ...
38
votes
Why can't I copy my DVD with dd?
People mention that opening the DVD with VLC (which displays the DVD menu) magically makes the data accessible to dd, but nobody has yet explained why that is and how VLC accomplishes this feat.
I ...
38
votes
Accepted
What are the contents of /bin/bash, and what do I do if I accidentally overwrote them
bash is a shell, probably your system shell, so now weird things happen, while parts of the shell are still in memory. Once you log out or reboot, you,ll be in deeper trouble.
So the first thing ...
28
votes
Accepted
How to recover a broken mp4 file: moov atom not found
You can try and use Untrunc to fix the file.
Restore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you
have a similar not broken video.
you may need to compile it from source, but ...
26
votes
Recover deleted files on Linux
Recovery Tools - Command Line:
testdisk - open source, dir-structure
photorec - open source, NTFS
extundelete - open source
Recovery Tools - GUI:
R-Linux - proprietary, free, dir-structure
R-...
23
votes
Accepted
what does star in passwd file mean?
You have to check man passwd:
If the encrypted password is set to an asterisk (*), the user will be
unable to login using login(1), but may still login using rlogin(1),
run ...
22
votes
How to mount/recover data on a disk that was part of a mdadm raid 1 on another machine?
This is working excellently in Ubuntu 14.04:
sudo -i
mdadm --assemble --scan
You will get:
mdadm: /dev/md/1 has been started with 1 drive (out of 2)
Then mount and see your files:
cd /mnt &&...
21
votes
I've just "mv"ed a 49GB directory to a bad file path, is it possible to restore the original state of the files?
After getting Stephen Kitt's answer and discussing this command as a potential solution:
sudo mv -i ~/my_data_on_60GB_partition/* /media/admin/my_data/
I decided to hold off on running it until I ...
19
votes
Accepted
Using ddrescue to shred only rescued portions of disk
The manual gives you an example which is almost exactly what you want:
When ddrescue is invoked with the option --fill-mode it operates in "fill mode", which is different from the default &...
18
votes
Accepted
Read past end of file to recover data
Usually when editors save files, they delete or truncate to 0, thus freeing allocated space, and then write, which allocates new space. This results in the filesystem putting the data in a completely ...
17
votes
Recover deleted files on Linux
Although this Question is solved and a few years old,
I want to mention the testdisk utility.
How to recover files with testdisk is explained well in this tutorial.
To recover files run testdisk /...
17
votes
Why does photorec keep finding files after I have filled the disk free space as root?
There may be several misunderstandings here, so the command does not do what you perhaps expect it to.
sudo is superfluous since you don't need sudo to read from /dev/urandom. The > some-file part ...
16
votes
Accepted
How to mount and de-encrypt a LUKS encrypted partition to recover files
To recover your files you will first need to open your LUKS container. This will make your LVM logical volumes accessible. Then, you can mount the appropriate logical volume to gain access to the ...
15
votes
Accepted
Undoing wipefs --all --force /dev/sda? /dev/sda
You're lucky that wipefs actually prints out the parts it wipes.
These,
wipefs -a /dev/sda
/dev/sda: 8 bytes were erased at offset 0x00000200 (gpt): 45 46 49 20 50 41 52 54
/dev/sda: 8 bytes were ...
15
votes
Accepted
Overwritten LUKS with a partition table
cryptsetup repair, Part Two — Full Header Recovery
See also: cryptsetup repair, Part One — Magic Bytes Recovery
In order to recover a partially overwritten LUKS2 header, you need at minimum two ...
14
votes
Deleted first 512 bytes of disk; how can I recover my data?
It depends on what exactly was there before, but it might be easy(-ish) to recover from this.
Use dd to create a full image of your USB drive on a safe location.
Use dd to create a full image of ...
13
votes
Can overwritten files be recovered?
Make sure you have enough disk space in /var/tmp or somewhere big.
Try
grep -i -a -B100 -A100 'a string unique to your file' /dev/sda1 |
strings > /var/tmp/my-recovered-file
where /dev/sda1 ...
13
votes
what does star in passwd file mean?
The accounts with passwords are the accounts with a glob of base64 gibberish in the second field:
root:8sh9JBUR0VYeQ:0:0:Super-User,,,,,,,:/:/bin/ksh
lp:VvHUV8idZH1uM:9:9:Print Spooler Owner:/var/...
13
votes
Accepted
How can I safely recover deleted data from a USB flash drive?
Are there any secure UNIX tools to recover data, that was removed with rm, from a USB flash drive?
Yes and, by the way, recovery of photos is one of the most common scenarios.
The conditions you ...
12
votes
Recover deleted files on Linux
An alternative may be using del instead of rm for deleting:
http://fex.belwue.de/fstools/del.html
del has an undelete function and works with any file system.
Of course it is not a solution if you ...
12
votes
DDRescue taking months but no errors?
If anyone is interested or comes across an archived version of this in a few years. I waited the two months, establishing a log file to resume copying. Twice it just started getting reading errors (...
12
votes
Accepted
Unable to untar file after tar error
On the line
$ tar cvzf file.txt file.tar.gz
you have asked to create a compressed archive of the file file.tar.gz, and that the archive should be called file.txt. You have simply swapped the two ...
12
votes
md raid5: "no valid superblock", but mdadm --examine says everything is fine
The stupidly simple solution: add --update=devicesize when assembling.
I have no idea how, but apparently the partition size and the size that md remembered for this drive didn't match up anymore. ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
data-recovery × 853linux × 137
ext4 × 87
hard-disk × 83
filesystems × 77
partition × 77
ddrescue × 69
ubuntu × 58
lvm × 49
files × 47
raid × 39
deleted-files × 31
debian × 30
ntfs × 29
testdisk × 29
mount × 28
mdadm × 26
luks × 24
centos × 23
tar × 23
rm × 22
dd × 21
btrfs × 21
corruption × 20
forensics × 20