13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 5 ■ WORKING WITH FILESYSTEMS40 */4 * * * /usr/local/bin/rsnapshot hourly30 02 * * * /usr/local/bin/rsnapshot daily20 02 * * 7 /usr/local/bin/rsnapshot weeklyThe hourly/daily/weekly retain levels don’t actually have to be at hourly/daily/weekly rates; they’rejust labels. You can set them to run however often you like in the cronjob. What the value in the configfile does is to set how many of each are retained. So here, we’re running the “hourly” snapshot every 4hours, and thus we keep 6 past versions to make up 24 hours (at which point a “daily” snapshot will betaken and the “hourly” can restart).■ Note If you get lock error messages from the “hourly” backup occasionally, it may be that the “daily” still hasthe lock. Increase the ten-minute interval between the two in the crontab to solve this. Here’s an example:50 */4 * * * /usr/local/bin/rsnapshot hourlyMake sure you set /snapshots/ to be owned by root so that users can’t modify their own files:chown root:root /snapshots; chmod og-w /snapshotsTo set up rsnapshot so any user can pull their own backups, rather than relying on root access,simply give read/execute access to this directory:chmod a+rx /snapshotsand then export it read-only over NFS, with the following line in /etc/exports:/snapshots 192.168.0.0/255.255.0.0(ro)Restart nfs-kernel-server (/etc/init.d/nfs-kernel-server restart) when you’ve finished editing/etc/exports. The files should be saved with the appropriate ownership and permissions, so any usercan grab their own files but won’t be able to modify them, because the share is read-only.rsnapshot should run on nearly any Unix-type system (requiring only perl and rsync) and isavailable as a package for most of the major <strong>Linux</strong>es.5-8. Working with Other FilesystemsAs well as the standard ext2 and ext3 <strong>Linux</strong> filesystems, other filesystems are available that you may wantto investigate. You may have to recompile your kernel to use these (either as modules or built in to thekernel). Find out what filesystems your current kernel supports using this:> cat /proc/filesystems132Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!