# All data in home directory lost after kernel panic



## alphachi (Jun 14, 2017)

Today I upgraded my system to 10.3-STABLE r319937 successfully. It's installed on UFS with GELI.

When I double-click a VM in virtualbox, the system reboots because of a kernel panic. After autofsck, the login prompt shows, but the system reboots again while I input my login imformation and press Enter. I have to boot single user mode and run fsck manually, then login as root. Everything is fine, however I suddenly find all data in my home directory disappeared; that is to say, my home directory is empty.

I think my data still exists on the disk and this is just the problem about filesystem, because:

The total size of my home directory is about 132GB before. When I check the output of `df -h` now, the value of "Used" is still about 132GB.
The operation of user login shouldn't cause a kernel panic, even though the home directory is empty.
`ls -a /home/fbsd` hasn't any output, but normally it should output . and .. at least.

I try to use recoverdisk(1) to recover a file that I can remember its name. For example:

```
# recoverdisk /home/fbsd/.zshrc .zshrc
Bigsize = 1048576, medsize = 32768, minsize = 512
start    size    block-len    state    done    remaining    % done
    0    4220         4220        0    4220            0    100.00000
Completed
```
Although I checked this file and confirmed the recovery is successful, I can't recover all data by this way since it's impossible to remember all filenames. As far as I know, recoverdisk(1) doesn't support directory recovery like `recoverdisk <src_dir> <des_dir>`. Should I try to use something like `recoverdisk /dev/<geli_node> <usbmnt_dir>` firstly?

Any idea about this? Thanks!


----------



## tingo (Jun 14, 2017)

you should read fsck_ffs(8). Look for the section that describes the lost+found directory.
Your point #2 is correct, but your reason (user login) for the reboot / panic is probably wrong. Most likely the system panicked because fsck couldn't fix the filesystem automatically. You must run fsck manually when this happens.
Lastly, you should have a backup of valuable data (contents of your home directory?).


----------



## ShelLuser (Jun 14, 2017)

Not much info to go with here. How did you set up your system for example? Did you spread it out over different file systems, if so what are those?  Maybe you could show us the output of `gpart show` which would give us a bit more overview.

Generally speaking: reboot in single user mode, `fsck -c /etc/fstab` and then check from there. /etc/fstab should be a good start. `# mount -uw / && mount -a`?


----------

