# bsdinstall question



## bkouhi (Feb 11, 2013)

Hi all,

This is my partition scheme:


```
/dev/ada0p1       /boot        64KB
/dev/ada0p2       /            3GB
/dev/ada0p3       swap         4G
/dev/ada0p4       /var         3G
/dev/ada0p5       /usr         70GB
/dev/ada0p6       /usr/home    350GB
```

I want to reinstall my FreeBSD. But I have very important documents in my /dev/ada0p6 (my home directory). I'm worry about it. Does *bsdinstall* format this partition? How I can format /, /var, /usr, /boot but not /usr/home?


----------



## Beastie (Feb 11, 2013)

AFAIK, yes, it runs newfs on all the "default" partitions and there's no way to prevent it, as it was possible with sysinstall. But I may be wrong in both cases.

Regardless of what it does, it's always a good idea to make a backup of any personal/unique data before installing/upgrading. dump(8) is the best way to make backups.

By the way, may I ask why you want to reinstall it? If you have sufficient bandwidth and/or processing power, you might want to consider either a binary update over the network using freebsd-update(8) or by updating the source and rebuilding everything.


----------



## bkouhi (Feb 11, 2013)

Thanks Beastie. The reason is I've deleted my /etc directory by mistake (or maybe some more!). It's good if there is a way to repair my FreeBSD. Is there a way to do that?


----------



## wblock@ (Feb 11, 2013)

Do not reinstall on that disk.  Disconnect it and install on a different disk.  Then reconnect the old drive, mount the partitions, and copy any data.  If you don't want to do a full install, mfsBSD will work.  You'll still need another disk as a destination.


----------



## SirDice (Feb 11, 2013)

bkouhi said:
			
		

> Thanks Beastie. The reason is I've deleted my /etc directory by mistake (or maybe some more!). It's good if there is a way to repair my FreeBSD. Is there a way to do that?



You might be able to restore a 'clean' post-install /etc/ if you have the full source tree:

```
cd /usr/src/etc/
make distribution
```


----------



## bkouhi (Feb 11, 2013)

I think there is no need to reinstall any more. I've boot my computer in live mode and copied /etc directory from live system into my original system. Then edited some critical files like fstab, rc.conf and more. Also I've added a user and changed root password. Now I can login to my FreeBSD but I have still some serious problem. I did:

`# pkg_delete -ad`
`# cd /usr/src && make buildworld kernel installworld`

But is there a way to rollback /etc directory? I heard something about *make distribution* before but can you tell me the exact command? It's not work.

EDIT: I didn't see SirDice's post when I posted this. When I run *make distribution*, it tell me "set DESTDIR variable". Is this Ok:
`# make DESTDIR=/ distribution`


----------



## wblock@ (Feb 11, 2013)

Please stop writing to the only backup you have.  If there is any data to be saved, changes are making that less and less likely.

Don't mess with packages or source.  Source distributions will not help much, because the files you need in /etc are the ones you changed.

The only way to roll back is if you made a backup.  That can be manual, or sysutils/rsnapshot does a very nice job with hourly/daily/month archives.


----------



## Beastie (Feb 12, 2013)

Sorry for the delayed reply. For what it's worth, you can extract any file/directory from the distribution archives. If you have the installation media (CD/DVD/pendrive), you should find these archives somewhere within /usr.

From there, it's just a matter of extracting the "/etc" files from the archive to your disk. I guess something like the following should work:
`# tar -xvf base.txz -C /mnt/the_partition_with_the_missing_files ./etc`

No matter what, ALWAYS MAKE BACKUPS!!!


----------

