Ubuntu: Unable to find my files, but they take up space



Question:

I've created a new Ubuntu installation and wanted to copy my old files over, but I had complications so I booted into a LiveUSB and did the copying part there, and everything seemed to go fine (files copied, etc.). However, when I boot into the new Ubuntu installations I can't find the files; they are not in the location where I copied them, however the space seems to be allocated for them.

df -h shows (this is a fresh install so those 100 GB must be my files)  /dev/mapper/ubuntu--vg-root  451G  113G  315G  27% /    du -sh /home/username/ shows only 58 MB  58M    /home/username/  

However, when I open the Disk Usage analyzer I get these: overview, overview of / which seems to indicated my files are there somewhere.

I've tried find and locate, but they didn't find my files. Also running du -sh /* shows that no folder is bigger than 3 GB.


Solution:1

I have a strong suspicion you have another partition mounted on /home. When you booted to a live USB, you didn't mount that partition, so files copied to your home directory were copied to your home directory on the partition mounted on /. When Ubuntu boots and mounts something on /home, the old contents are effectively inaccessible until you unmount /home.

You can bind mount / elsewhere to access the directory masked by other mounts:

mkdir foo  sudo mount --bind / foo  du -sh foo/home  


Solution:2

Step 0. Read man locate.
Step 1. Ensure the locate database is up-to-date:

sudo /etc/cron.daily/locate    

This will take several minutes - have patience.

Step 2. Use locate to find one of your files that has a unique-to-you name. E.g.:

locate GeorgeRomero_Birth_Certificate    

(if your name is "George Romero". Mine isn't, YMMV.)

Step 3. Read man mv and consider using mv to move a whole directory structure to where you want it. E.g., if the Step 2 locate showed:

/some/where/Documents/GeorgeRomero_Birth_Certificate    

you could do something like mv --target-directory=$HOME /some/where/Documents.


Solution:3

More simply, you could

sudo find / -type f -name GeorgeRomero_Birth_Certificate -print  


Solution:4

If you open a terminal and cd / then this command

sudo du -aBM -d 1 . | sort -nr | head -20

will show you the 20 largest directories (including subdirs) in your file system - it does take a while to run the first time. You can then change to what looks like a larger than expected directory, and run the command again, looking for again bigger then expected directories, and hopefully you will eventually find your files.

chick@dad:/$ sudo du -aBM -d 1 . | sort -nr | head -20  [sudo] password for chick:   du: cannot access './proc/30738/task/30738/fd/4': No such file or directory  du: cannot access './proc/30738/task/30738/fdinfo/4': No such file or directory  du: cannot access './proc/30738/fd/3': No such file or directory  du: cannot access './proc/30738/fdinfo/3': No such file or directory  du: cannot access './run/user/1000/gvfs': Permission denied  655023M .  645220M ./home  5481M   ./usr  2049M   ./swapfile  860M    ./lib  668M    ./var  491M    ./opt  201M    ./boot  17M ./sbin  16M ./etc  15M ./bin  11M ./run  1M  ./tmp  1M  ./srv  1M  ./snap  1M  ./root  1M  ./mnt  1M  ./media  1M  ./lost+found  1M  ./lib64  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »