- Remove logical volume created in an earlier lab if it still exists.
umount /iso
lvremove /dev/cit470/my_isos
vgdisplay -v
- Create new logical volume, leaving room in VG for snapshots
lvcreate -n users --size 4G cit470 # Create a 4GB users volume
mke2fs -v -j /dev/cit470/users # Make an ext3 filesystem
mkdir /users # Create a mount point
vim /etc/fstab # Cfg /users to mount on boot
mount /users # Mount /users
- Create test files under /users.
cd /users
tar xvjf /var/backup/home_*
mv home/student .
rm -rf home
dd if=/dev/zero of=/users/2MB_File bs=2048 count=1024
- Load the Snapshot kernel module
modprobe dm-snapshot
- Create a snapshot of the users volume.
lvcreate -s -L 100M -n users_snap /dev/cit470/users
- Check the logical volume status information.
lvs
- Mount the snapshot and examine its contents. How do they compare to the contents of the original volume?
mkdir /users/snap
mount /dev/cit470/users_snap /users/snap
ls -l /users/snap
- Remove a file from /users, simulating an accidental deletion.
rm /users/2MB_File
ls -l /users/2MB* /users/snap/2MB*
- Check disk usage of both logical volumes.
lvs
- Recover the file from the snapshot.
cp -p /users/snap/2MB_File /users
- Remove the snapshot
umount /users/snap
lvremove /dev/cit470/users_snap
- Implement a cron job to create a new snapshot of /users every hour. The snapshot should include a timestamp in its name. The cron job should also remove snapshots older than 24 hours. Include the crontab line and the script in your lab submission.