# Best way to rescue configuration files



## jonfr (Jun 29, 2013)

_A f_ew days ago a thunderstorm damage_d_ my server beyond repair (it doesn't detect the hard drive). The hard drive in question works on my desktop computer.

Now I have _a_ new server computer and I am moving to FreeBSD 64-bit from _the_ 32-bit version. I do not want to configure all my config files again, so I need to copy them from the old drive. I am not sure _about_ what is the best way to do so in FreeBSD, since I am not sure on how to add _a_ new hard drive to a system once it is up and running.

Thanks for the help.


----------



## ShelLuser (Jun 29, 2013)

jonfr said:
			
		

> Now I have new server computer and I am moving to FreeBSD 64-bit from 32-bit version. I do not want to configure all my config files again, so I need to copy them from the old drive.


My suggestion would be to copy everything from /etc and /usr/local/etc while also paying close attention to any optional manual changes to /boot/loader.conf. I'd use tar to copy these directories. Then simply re-install the new system and replace the necessary configuration files.

Either completely or partially, but that heavily depends on the way you set up your system. What I most certainly do not recommend is copying these directories and then restoring them just the way they were. That is bound to cause lots of problems. So I'd definitely do this on a per-program basis.

Hope this can help.


----------



## jozze (Jun 29, 2013)

For such cases, I would recommend you to create a repository on github (if you use git) or assembla (if don't want to use git, but svn instead) -- they're both free of any charge, provided that your code is open to the eyes of the public. You can use those repositories to contain backups of your configuration files.

Also, don't forget any files in your home directories (most notably /root/.*) and anything _in_ your /home/*/.*.


----------



## wblock@ (Jun 30, 2013)

Install a new hard drive in the new machine.  Do not use the old drive, at least for now.  Install FreeBSD on the new drive in the new machine.  Finally, connect the old drive.  It will show up as another drive*, ada1 usually.  Mount the partitions and copy all the old config files into a temporary directory on the new drive.  Then disconnect the old drive and put it away somewhere as a backup.  As you use the new system, copy the config files from the temporary directory.

* This assumes that the old drive still works.  If it does not... restore from backup.  If you don't have a backup, now is a good time to start.


----------



## jonfr (Jun 30, 2013)

I have a backup of my backups and one offsite backup. The configuration files had just not entered the backup cycle, since I was still working on them. The hard drive works (it at least boots up), I have tested it on my desktop computer.

I just want to copy apache configuration files (few), mrtg configuration and log file and I need to copy the samba configuration file. Other configuration files do not matter.


----------



## jonfr (Jul 2, 2013)

Now I need to mount the FreeBSD partition on my Gentoo Linux computer. This is the information I get from Gentoo Linux on my hard drive.

This hard drive also gave me a SMART warning on that it is dying. So I am not sure if it actually works, but I like to find out.


```
[    1.777371] sd 0:0:0:0: [sda] 488395055 512-byte logical blocks: (250 GB/232 GiB)
[    1.777411] sd 0:0:0:0: [sda] Write Protect is off
[    1.777414] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    1.777451] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA

[...]

[    1.932402]  sda: sda1 sda2 sda3 sda4

[...]

mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...
mount -t ufs -o ufstype=sun|sunx86|44bsd|ufs2|5xbsd|old|hp|nextstep|nextstep-cd|openstep ...
```

I tested this mount setting, but I got this error.


```
mount -t ufs -o ufstype=44bsd,uid=jonfr /dev/sda3 /mnt/freebsd.1
mount: wrong fs type, bad option, bad superblock on /dev/sda3,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail or so
```

I just need to copy few configuration files, so I do not have to work them up from my older Gentoo Linux copies that are un-edited versions. If that is possible to start with.

Thanks for the help.


----------



## wblock@ (Jul 2, 2013)

Use ufs2.


----------



## jonfr (Jul 2, 2013)

I actually managed to boot FreeBSD on my desktop computer. From there I was able to copy the configuration files I wanted to a _USB_ stick. Now I just have to copy the configuration files that I have to the new server. It is going to be some work, but this is better than starting from the ground up.

Thanks for the help.


----------

