Backups (dump / restore)

These instructions are fairly pedantic as I use them for setting up my own automated backup system. It should be a generally useful reference though if you're setting up automated backups or an nfs mount.

I use Services for Unix on Windows as the NFS server on which to store backups. It should be fairly straightforward to use any other NFS server.

Automated Backup

 * 1) Set up Services for Unix on a Windows server and include the related components such as user name mapping.
 * 2) Upload the passwd and group files to the server and reference them as the files to use for user name mapping.
 * 3) In the SFU user interface, set up a map between root and a local user, for example IUSR_[MachineName]. (This particular example will also enable the locally installed web server to access content shared via nfs, so you may prefer to just create a new user specifically for nfs instead.)
 * 4) Disable "simple maps" on the "user name mapping" screen. This will prevent standard user accounts on the NetBSD box from having implicit access to nfs shared content.
 * 5) Create a client group AtariGroup in which the Atari client machine is a member.
 * 6) Right-click Server for NFS to stop and restart the server.
 * 7) Right-click User Name Mapping to stop and restart the user name mapping service.
 * 8) Right-click the directory you want to share in the shell and go to the NFS Sharing tab.
 * 9) Select to share the folder and give it a name.
 * 10) Disable anonymous access.
 * 11) Click Permissions.
 * 12) Disable ALL MACHINES access and root access for ALL MACHINES.
 * 13) Add the AtariGroup into the NFS share permissions and set access to Read-Write with root access allowed.
 * 14) In the Security tab, add IUSR_[MachineName] or whatever mapped user use used for the NFS permissions previously.
 * 15) You may want to remove acces to other groups that this account could be a member of, ex: Users.
 * 16) The advanced permissions for IUSR_[MachineName] can be set to allow this user only the following permissions:
 * 17) Traverse Folder / Execute File
 * 18) Read Attributes
 * 19) Create Files / Write Data
 * 20) Create Folders / Append Data
 * 21) Write Attributes
 * 22) This will restrict directory listing, even for the root user. Read permissions (for restore) will automatically be granted to the created backup files.
 * 23) Back on the atari, su to root.
 * 24) You should be able to see the share with showmount -e [MachineName]
 * 25) mkdir /AtariBackup
 * 26) chmod 200 /AtariBackup
 * 27) mount_nfs -w 65536 [MachineName]:/AtariBackup /AtariBackup
 * 28) *Some testing in my own configuration revealed that the -w option specified above gave better transfer rates over 10 megabit ethernet than the default setting. The same value for -r caused the NFS client to lock up, so I'd advise against modifying the -r option.
 * 29) Now you should be able to copy files to /AtariBackup and see them on the server machine. You shouldn't be able to see a directory listing as root, but you should be able to read the files back if you reference them directly. You shouldn't be able to view /AtariBackup at all as non-root.
 * 30) To try a full dump manually, do:
 * 31) Set up a decent backup script. This example uses one from the nixCraft shell script collection, provided here.
 * 32) Copy the script to ~root/tapebackup.sh
 * 33) chmod 700 tapebackup.sh
 * 34) mkdir /var/log/dumps
 * 35) chmod 700 /var/log/dumps
 * 36) Edit tapebackup.sh, changing:
 * 37) *FSL = "/"
 * 38) **This will set the whole root filesystem for backup.
 * 39) *TAPE = "/AtariBackup/backup.`date +'%Y%m%d%H%M%S'`"
 * 40) *opts = "-${level}uantX -f ${tape}"
 * 41) Save and exit the editor.
 * 42) crontab -e
 * 43) Add the following line:
 * 44) *@midnight /root/tapebackup.sh
 * 45) Save and exit the editor.
 * 46) Edit /etc/fstab and add the following to auto-mount the nfs share:
 * 47) *[MachineName]:/AtariBackup /AtariBackup nfs rw,-w=65536
 * 48) *(use tab instead of spaces above)
 * 49) Save and exit the editor.
 * 50) shutdown -r now
 * 51) Now the system will perform a backup each night. On Monday (Sunday night) it will do a full backup, with subsequent backups in that week being incremental.

Restore

 * 1) To restore individual files:
 * 2) *cd /
 * 3) **If you don't do this, the full extracted directory structure will appear under your current directory.
 * 4) *restore -i -f /AtariBackup/backup.[date]
 * 5) *If backup is set up as described above, the last full backup will be on Monday (Sunday night). Incremental backups throughout the week will contain any changes that happened since the previous backup. When restoring, the restore program only operates on the particular file referenced in the command line, not the whole stack of backups created since the last full backup.
 * 6) Use the commands describe in the restore man page to restore files in interactive mode. Generally speaking, this would be something like:
 * 7) *cd / ls to examine the backup.
 * 8) *add [filename]
 * 9) *extract
 * 1
 * 1) *quit
 * 2) Other restore options can be used to restore the entire filesystem, etc.