• No results found

Customize the File Systems

In document 3116_workbook.pdf (Page 44-48)

Part I: Run e2fsck

To run e2fsck, do the following:

1. If if your da1 virtual machine is stoped or suspended, start it.

2. If necessary, log into da1 as geeko with a password of novell.

3. Open a terminal session and switch to your root user account by entering su - followed by a password of novell at the shell prompt.

4. Unmount the file system on /dev/sda5 by entering

umount /apps

5. Verify that the file system is no longer mounted by entering mount

The /dev/sda5 partition should not be listed in the output of the mount command.

6. Start a file system check on /dev/sda5 running in verbose mode with an

automatic response of yes to all prompts by entering

e2fsck -f -y -v /dev/sda5

7. Mount the /apps file system again by entering

mount /apps

8. Verify that the file system on /dev/sda5 is mounted by entering mount

Part II: Customize the File Systems

In this part of the exercise, you add a journal to an ext2 file system, effectively making it an ext3 file system. Complete the following:

1. Modify the /dev/sda8 partition:

a. In the terminal window, umount the /dev/sda8 partition and view details about the ext2 file system on it by entering

Administer the Linux File System

dumpe2fs /dev/sda8 | more

Notice the Filesystem features and the Filesystem state.

b. While the file system is unmounted, give the ext2 file system a volume name of /export/data2 by entering

tune2fs -L /export/data2 /dev/sda8

NOTE: It is common practice to use this naming convention. Naming a file system after its mount point can be useful in system rescue situations when the /etc/fstab file is not available.

c. Verify that the file system now has a volume name by entering dumpe2fs /dev/sda8 | less

You should see that the Filesystem volume name has been set to the partition’s mount point, /export/data2.

d. Add a journal to the file system (making it an ext3 file system) by entering tune2fs -j /dev/sda8

e. Verify that the file system now contains a journal by entering dumpe2fs /dev/sda8 | less

The Filesystem features line should now contain an entry “has_journal”.

f. Mount /dev/sda8 again by entering

mount /dev/sda8

g. View information on the mounted file systems by entering mount

Notice that the file system is still mounted as an ext2 file system.

h. Unmount the partition /dev/sda8 again by entering

umount /dev/sda8

i. Verify that the file system state is clean by entering dumpe2fs /dev/sda8 | less

j. Edit the /etc/fstab file to change the file system type from ext2 to ext3 by entering vi /etc/fstab at the shell prompt.

k. Press Ins.

l. Locate the entry for /dev/sda8 and change the file system type from ext2 to ext3, as in the following:

/dev/sda8 /export/data2 ext3 defaults 1 2

m. Press Esc, then enter :exit to save the changes to the file and exit the vi editor.

n. At the command line, reread /etc/fstab and mount the partition as an

mount -a

o. Verify the change by entering mount

You should see that /dev/sda8 has been mounted as an ext3 file system.

p. Unmount the partition /dev/sda8 again by entering

umount /export/data2

q. Mount the partition as an ext2 file system manually by entering mount -t ext2 /dev/sda8 /export/data2

r. Verify that the file system is mounted without a journal (as an ext2 file system) by entering

mount

As you can see, ext3 is backward compatible with ext2.

s. Remount /dev/sda8 as an ext3 file system and verify the change by

entering the following commands: umount /export/data2 mount -a

mount

2. Create a snapshot for the /srv/www/ subvolume by doing the following:

a. Create a before_snapshot.html file in /srv/www/htdocs by

entering

touch /srv/www/htdocs/before_snapshot.html

b. Create a read-only snapshot for the /srv/www subvolume by entering

cd /srv

btrfs subvolume snapshot -r www www-snapshot

c. List the existing snapshots by entering btrfs subvolume list

d. Try to create a file in the /srv/www-snapshot/htdocs/ directory by

entering

touch /srv/www-snapshot/htdocs/file

You should see a message that touch cannot create the file on a read-only file system.

e. Create a after_snapshot.html file in /srv/www/htdocs by

entering

touch /srv/www/htdocs/after_snapshot.html

f. View the content of the /srv/www-snapshot/htdocs directory by entering ls /srv/www-snapshot/htdocs

Administer the Linux File System

You should see the before_snapshot.html file, but not the after_snapshot.html file.

You could back up the snapshot htdocs directory now without changes to the original htdocs directory interfering with the backup.

g. Delete the snapshot by entering

btrfs subvolume delete www-snapshot

Snapshots are actually specialized subvolumes and can be deleted like any subvolume with with the btrfs subvolume delete command.

Exercise 4-3 Create Logical Volumes

In this exercise, you learn how to administer LVM with YaST.

In the first part of this exercise, you use YaST to create two physical volumes (PVs) with a size of 1 GB each. You then add them to a volume group (VG) named projects. Within the volume group, you next add two logical volumes named pilot (750 MB) and production (300 MB) which will be mounted under /projects/pilot and / projects/production, respectively.

In the second part of the exercise, you increase the size of the logical volume

production to the maximum space available within the volume group.

Complete the following:

In document 3116_workbook.pdf (Page 44-48)

Related documents