how to back up files over the network with FreeBSD December 15th, 2008
This procedure details how to copy data from a FreeBSD drive to a network drive. The network drive is
assumed to be available with the SMB protocol. This means the procedure below can be used to copy files to
a Windows server, or to a unix server running Samba.
The procedure is NOT for backing up system files, it is for backing up data directories.
ensure you're logged in as root on the FreeBSD machine (the machine to copy files FROM)
ensure the mountpoint (used below) is created before attempting the mount command
ensure you can see the share when you run the df command
Now to copy the data. If you're brave, you can copy all the data at once, however this is not recommended
as it will stress your hardware. It's recommended to copy one directory at a time, leaving some time between
directories. This will allow your hardware time to cool. It will also minimise the damage, if you copy the wrong
thing to the wrong place. Use this command to copy the /example/source directory, and all its subdirectories, from the
old drive to the new drive:
This will create the "source" directory in the "example" directory on the remote volume. The "example" directory
must already exist.
repeat the above command for each directory to copy
(optional) test the copied data somehow, if there's a large ZIP file this can be tested for errors
unmount the remote volume:
umount /mnt/mountpoint
Notes:
Note the lack of a trailing slash (/) on the above paths. This tells the cp command to create the source directory inside the target directory,
then copy the source files into it. If a trailing slash is provided on the source path, the source directory will not be created inside the target directory - instead,
the files from the source directory will be copied directly into the target directory.
The above copy command uses the -p switch, this preserves file permissions and timestamps. See the cp manpage
for more information.