# File System Corruption - cannot  rebuild ports due to missing Makefile etc.



## dougs (Mar 14, 2012)

Hello all-

Due to file system corruption on my proxy server which was repaired to the best of my ability, I am finding that files are missing from the ports installation directories. For example,

```
root@squid:/usr/ports/net/openldap24-client# ll
total 2
-rw-r--r--  1 root  wheel  337 May 25  2006 Makefile
root@squid:/usr/ports/net/openldap24-client# make install clean
"Makefile", line 13: Could not find /usr/ports/net/openldap24-client/../openldap24-server/Makefile
make: fatal errors encountered -- cannot continue
root@squid:/usr/ports/net/openldap24-client#
```

I tried *portsnap fetch* and it doesn't recreate these installation files. How do I get portsnap to recreate these files? I use portmaster as my port management tool. But that doesn't preclude the use of other ports management tools if these would help me rebuild ports.

9.0-RELEASE

~Doug


----------



## dougs (Mar 14, 2012)

I tried running *portsnap install* and it reported that the snapshot was bad. 

Okay, [cmd=]rm -rf /var/db/portsnap/*[/cmd] and retrieve snother portsnap snapshot. Ran *portsnap update* and now can install that port. Apparently I had a corrupted portsnap snapshot.

~Doug


----------



## kpa (Mar 14, 2012)

`# portsnap fetch` only fetches updates to the ports tree, you'll have to do `# portsnap update`. If that doesn't help recreate /usr/ports with `# portsnap extract`.


----------



## phoenix (Mar 14, 2012)

```
# rm -rf /usr/ports/*
# rm -rf /var/db/portsnap/files/*
# portsnap fetch extract
```
That will completely clear out the ports tree, remove all the history for portsnap, fetch the latest portsnap tarball, and create a new ports tree.

Since you have filesystem corruption already, the "nuke'n pave" method is the only way to be sure everything is in place.


----------



## dougs (Mar 14, 2012)

@phoenix, yep, I've done what you suggested and now am happily rebuilding all ports.

~Doug


----------

