Exercise instructions with hints
__ 40. The /home/AN14 directory has a script called filegen which will generate 10 files of 10 MB each in a specified directory Use the script to place files in the file system
you just created and then list the files.
The filegen script accepts a single argument with the path to the directory in which to place the files.
Here is the code in the script: for f in 0 1 2 3 4 5 6 7 8 9 do
dd if=/dev/zero bs=10k count=1024 of=${1}/sfile$f done
» # /home/AN14/filegen /myfs » # ls -l /myfs
__ 41. Create an external snapshot for the /myfs file system, size 100 MB. Record the name of the created snapshot logical volume _____________________________ » The suggested commands are:
» # snapshot -o snapfrom=/myfs -o size=100M OR
» # smitty jfs2
» Select Create Snapshot for an Enhanced Journaled File System > Create
Snapshot for an Enhanced Journaled File System in New Logical Volume.
File System Name /myfs SIZE of snapshot
Unit Size Megabytes + * Number of units [100] # __ 42. Display the snapshots for /myfs. Record the name of the logical volume that was
created. Record the free space for the listed external snapshot.
____________________________________________________________ ____________________________________________________________ » The suggested commands are:
» # snapshot -q /myfs OR
» # smitty jfs2
» Select List Snapshots for an Enhanced Journaled File System.
* File System Name [/myfs] + __ 43. Delete all of the files in the /myfs directory.
» # rm /myfs/*
__ 44. Verify that the files have been deleted. » # ls /myfs
__ 45. Display the space utilization of the listed external snapshot. Record the amount of free space. ___________________________________________________
Did the snapshot space fill up significantly? What would be the impact of running out of space in a snapshot?
EXempty ___________________________________________________________ » The suggested commands are:
» # snapshot -q /myfs OR
» # smitty jfs2
» Select List Snapshots for an Enhanced Journaled File System.
* File System Name [/myfs] + » The snapshot filled up significantly, with the original data blocks of the deleted files. If
the external snapshot logical volume ran out of space, the entire snapshot would have been invalidated and would be unusable.
__ 46. Access the snapshot by mounting the external snapshot LV (you recorded this name earlier) and show that the files are still shown there.
» The suggested command are: # mkdir /mntsnap
# mount -v jfs2 -o snapshot /dev/<snapshot_lv_name> /mntsnap # cd /mntsnap
# ls
__ 47. Restore a single file back to the snappedFS and verify that it is recovered. » Suggested commands are:
# cp sfile0 /myfs # ls /myfs
__ 48. Restore all of the /myfs file system contents to what they were when the snapshot was taken, using the snapshot rollback facility. Accept the default of removing the snapshot logical volume when the snapshot is deleted. Remember that you have to first unmount the snapshot and then unmount the file system, before executing the rollback. You can safely ignore any fsck errors, since the snapshot is being deleted. » The suggested commands are:
# cd
# unmount /mntsnap # unmount /myfs
# rollback -s /myfs /dev/<snapshot_lv_name> OR
# cd
# unmount /mntsnap # unmount /myfs # smitty jfs2
» Select Rollback an Enhanced Journaled File System to a Snapshot > Rollback an
Enhanced Journaled File System to an External Snapshot.
* File System Name [/myfs] + * Snapshot Location [/dev/<snapshot_lv_name>] + Remove Deleted Snapshot Logical Volumes? yes + __ 49. Remount the file system /myfs and check that the files have been restored to the
same state as when the snapshot was taken. » The suggested commands are:
# mount /myfs # ls -l /myfs
__ 50. If executing the optional steps on the internal snapshot, delay this until the end of the exercise.
Unmount and delete the /myfs file system. » The suggested commands are:
# umount /myfs # rmfs /myfs
EXempty
Part 6: (Optional) Using JFS2 internal snapshots
__ 51. Display the space utilization of the /myfs file system, in megabytes. Record the amount of free space. ___________________________________________ » # df -m /myfs
__ 52. Create an internal snapshot of the /myfs file system, named mysnap. » The suggested commands are:
» # snapshot -o snapfrom=/myfs -n mysnap OR
» # smitty jfs2
» Select Create Snapshot for an Enhanced Journaled File System > Create
Snapshot for an Enhanced Journaled File System in File System.
» (When prompted for the filesystem, select: /myfs.)
File System Name /myfs * Snapshot Name [mysnap] __ 53. Verify the snapshot was created.
» The suggested commands are: » # snapshot -q /myfs
OR
» # smitty jfs2
» Select List Snapshots for an Enhanced Journaled File System.
* File System Name [/myfs] + __ 54. Delete all of the files in the /myfs directory. (Ignore messages about lost+found.) » # rm /myfs/*
__ 55. Verify that the files have been deleted. » # ls /myfs
__ 56. Display the space utilization of the /myfs file system, in megabytes. Record the amount of free space. __________________________________________ Did the file system size decrease as a result of deleting all the files? Why? ___________________________________________________________ ___________________________________________________________ » # df -m /myfs
» The file system size did not significantly decrease. That is because the deleted files were first copied to the snapshot which is also part of the file system space allocation. __ 57. Access the snapshot and show that the files are still shown there.
» The suggested commands are: # cd /myfs/.snapshot/mysnap # ls
__ 58. Restore a single file back to the snappedFS and verify that it is recovered. » The suggested commands are:
# cp sfile0 /myfs # ls /myfs
__ 59. Restore all of the /myfs file system contents to what they were when the snapshot was taken, using the snapshot rollback facility.
» The suggested commands are: # cd /
# unmount /myfs
# rollback -n mysnap /myfs OR
# cd /
# unmount /myfs # smitty jfs2
Select Rollback an Enhanced Journaled File System to a Snapshot >
Rollback an Enhanced Journaled File System to an Internal Snapshot.
* File System Name /myfs
* Snapshot Name [mysnap] + __ 60. Remount the file system and verify that all of the files have been restored.
» The suggested commands are: # mount /myfs
# cd /myfs # ls
__ 61. List the snapshots for the /myfs file system. Is your snapshot still there? ____________________________________________________________.
EXempty » The suggested commands are: # snapshot -q /myfs OR
# smitty jfs2
Select List Snapshots for an Enhanced Journaled File System.
* File System Name [/myfs] + » You will note that the snap shot is gone. A rollback of a snapshot will result in the
deletion of the snapshot used for the rollback and any other snapshot which were created after that point in time.
__ 62. Unmount and delete the /myfs file system. » The suggested commands are:
# umount /myfs # rmfs /myfs