From time to time we make modifications to our Linux installation.
If you are like me from time to time you also "totally destroy" your installation.
Not a problem we can just do a reinstall of Linux from the CD-ROM.
But when we do that all of out changes are wiped out!
It would be nice to be able to save just those files we have modified.
Then patch our new Linux installation.
Linux provides tools to do this.
The 'cpio' utility was designed to create and restore an archive.
You can use 'cpio' to copy to any device.
'cpio' is good for incremental backups, with a little work.
Create a place to put the files. This uses the 4th IDE disk drive on my system. Create a Linux native partition on it with 'fdisk' Make the file system on this device with 'mkfs.ext2 /dev/hdd1' Make a mount point with 'mkdir /mnt/disk4' Mount the device with 'mount /dev/hdd1 /mnt/disk4' Show what is there with a 'ls /mnt/disk4 -la' Leave this device mounted Find files changed in last 7 days find / -mtime -7 -type -f > /mnt/disk4/bulog Using find and cpio to create the backup find / -mtime -7 -type f -print | cpio -o > /mnt/disk4/bu umount /mnt/disk4 The 4th IDE disk drive now has a list of modified files (bulog) and a backup set (bu). Reinstall Linux from your CD I used my kickstart floppy To reload the backup Log in to root and launch X windows. This will create necessary directories. Log out of X. Your new installation of Linux will not know that /dev/hdd is a Linux device. Use fdisk to create a Linux native partition on this drive. Write the partition information to disk. Make a mount point with 'mkdir /mnt/disk4' Mount drive with 'mount /dev/hdd1 /mnt/disk4' Restore the backup with 'cpio -i < /mnt/disk4/bu' Restart system with 'shutdown -r now'
cpio will NOT create mount points
Nor it seems backup /etc/fstab
You might want to write a bash procedure to do this task for you.
# Name: BackIt # Written: 3/7/98 frj # Purpose: Backup changes to Linux # echo "Begining backup" # Mount the device mount /dev/hdd1 /mnt/disk4 # Append to the backup log find / -mtime -7 -type -f >> /mnt/disk4/bulog # Append to the backup find / -mtime -7 -type f -print | cpio -o >> /mnt/disk4/bu # Done echo "Done with backup"
Of course backups should be more properly done to a removable media.
Because of the size of the initial backup I do not recommend floppy disks.
Simply replace calls to the Zip drive, if you have one, in the above.