Missing folder, but when using 'locate' the folder exists

My problem:

1- /usr/home <--- but directory home missing
2- I used the command locate /usr/home, result for example like this:
Code:
   /usr/home/adb
   /usr/home/fvb

3- When I type cd /home an error appears like this:
Code:
   /home: no such file or directory

So can anyone can help me? Because about 1000 users are inside folder home. I need a solution ASAP..
 
It's time to see if your backups worked. The directory is gone and you will need to restore it from backup.
 
From the description it could be that /usr/home exists but that the /home softlink is missing. If cd /usr/home succeeds, then the problem could be solved with:

[CMD=]ln -s /usr/home /home[/CMD]
 
when I type command cd /usr/home an error appear like this:
Code:
/usr/home: no such file or directory

what do I have to do to solve this problem?
 
MiesterSoul said:
how to use backup? using what command?
Backups are something you need to have done BEFORE you need to restore. You can't restore what isn't there.

  1. Have you made any backups, ever?
  2. Are you using ZFS?
  3. If so, have you made any snapshots of the filesystem that would contain /home? (Note that snapshots are a last resort in this instance, and do not constitute a proper backup system by themselves.)

If you don't have a backup but whatever partition or pool that was holding /home is not destroyed, chances are high that the information is still there, at least partially. You will need to look into data recovery options for whatever filesystem was housing that data.
 
OK. I repeat again my problem: when I type cd /usr/home an error appears like this:
Code:
/usr/home: no such file or directory

Then I use the command locate /usr/home to find the directory /home and I can find the directory /home but I cannot access it; the the error massage like this
Code:
/home: no such file or directory
. Why?
 
MiesterSoul said:
OK. I repeat again my problem: when I type cd /usr/home an error appears like this:
Code:
/usr/home: no such file or directory

Then I use the command locate /usr/home to find the directory /home and I can find the directory /home but I cannot access it; the the error massage like this
Code:
/home: no such file or directory
. Why?
It's because the database that locate uses is out of date and referring to whatever existed at the last time you ran updatedb. When was the last time you did an updatedb? Not sure what the command is on FreeBSD, but the principle remains the same. Locate is much faster than find because it caches the results of a search that searches through your whole file system. The downside to this is that this database needs to be updated.
 
I'm not sure when the last update of the database was. I'm a newbie in FreeBSD. Right now I just need to update the database, right?
 
carlton_draught said:
It's because the database that locate uses is out of date and referring to whatever existed at the last time you ran updatedb. When was the last time you did an updatedb? Not sure what the command is on FreeBSD, but the principle remains the same. Locate is much faster than find because it caches the results of a search that searches through your whole file system. The downside to this is that this database needs to be updated.

/etc/periodic/weekly/310.locate runs once a week by default. But it can be run manually any time you feel like it.
 
I think you misunderstood my question, my locate function is already updated as per your instruction. It's my home directory that has disappeared into thin air, my /usr/home does not exist. No, I do not have a backup of the server. Do you have any idea on how to solve my problem?
 
MiesterSoul said:
Do you have any idea on how to solve my problem?
There's nothing to solve. The directory is gone and the only way to restore it would be a backup. If you don't have backups then you are SOL.

I really can't believe people still don't understand the importance of a good backup. I've seen it 20 years ago, people losing 5 years worth of company data just because they were too cheap to invest in a good backup solution. And it's still happening, every day.
 
MiesterSoul said:
I think you misunderstood my question, my locate function is already updated as per to your instruction. It's my home directory has disappear out of thin air, my /usr/home does not exist. No, I do not have a backup of the server. Do you have any idea on how to solve my problem?
Not sure how you managed to have 1000 users of your server and not have some sort of backup system in place. Especially considering how flaky HDDs are these days. Murphy's Law will find a way to ream you somehow, especially if you aren't prepared for it.

Backups is why I spent a loooonggg time on this project. Because it's not enough to even have redundant storage on your live servers. All you do by doing that is increase the MTTDL by an extra order of magnitude or so. You need to have backups, and the restore needs to be tested regularly. (Note that I make no claim that this is a perfect way to backup and restore. I would like to see some comment from people who have actually used it, though so far 21 people have downloaded the scripts and no one has given feedback to say how things have worked, which may be a good thing. But anyway, IMO it's a step in the right direction. e.g. in the case you are in now, you would have had automatic snapshots of your home directory and probably just been able to roll it back.)

I suggest you start googling "UFS recovery" or "UFS data recovery". It sounds like you haven't had a head crash, so the data is almost certainly still there, it's just marked as ok to write over. So what you will want to do is to immediately prevent any more data being written, and figure out a way to recover the data from your erstwhile home directory. Maybe also copy your HDD(s) with dd. You might want to check that it hasn't moved or renamed, by doing the following:

# find / -iname "*file_name_that_was_in_home_dir*"

Replace the file name with something that should be in there somewhere. Maybe someone has renamed your home directory and put it somewhere? Just a thought. More likely it is deleted though, so you will need to recover things.

Also, you should answer the questions people have asked, as it helps them to help you. We still don't know whether you use UFS or ZFS.

A thread for you.
 
I have a backup on the server, but it's in .ldif file format. If I can't backup the files, at least I want to export the .ldif to my LDAP. Can anybody teach me on how to do this? I'm using UFS.
 
At best the ldif file will only restore the user accounts, not their home directories.
 
Shutdown the disk where /usr/home was and detach it or just umount /usr/home if it was a partition - highly unlikely in your case.

Get on another machine with big free disk space (at least the size of the old HDD). Install photorec on that machine, sysutils/testdisk from ports.

Attach the /usr/home disk on this machine (do not mount it) and run # photorec /dev/disk_device
Follow the instructions on the screen.

This will search for all files on that disk, even not deleted ones.

If /usr/home was removed in such a way that data was overwritten/corrupted in any way you will recover nothing.
 
Back
Top