ERODD HOME

Operating Systems CPSC 304
Earl Rodd erodd@malone.edu Extension 8546 www.malone.edu/erodd

EXT2 and Mounts Homework

Name __________________________

Note: To answer these questions, you need to refer to the online Linux documenation for EXT2.

The first questions refer to these Linux command outputs:

An ls -l / shows:

drwxr-xr-x 2 root root 4096 2007-05-06 10:25 bin drwxr-xr-x 3 root root 4096 2007-05-06 10:31 boot lrwxrwxrwx 1 root root 11 2006-08-04 21:34 cdrom -> media/cdrom drwxr-xr-x 16 root root 15060 2007-05-15 14:19 dev drwxr-xr-x 124 root root 8192 2007-05-15 18:04 etc drwxrwxrwx 2 root root 4096 2006-11-01 09:36 freedos drwxr-xr-x 14 root root 4096 2007-04-15 19:34 home drwxrwxrwx 2 root root 4096 2007-04-09 20:35 homeos2 drwxr-xr-x 2 root root 4096 2006-08-23 07:38 initrd drwxr-xr-x 19 root root 8192 2007-05-06 10:23 lib drwxr-xr-x 2 root root 4096 2006-08-23 07:38 lost+found drwxr-xr-x 7 root root 4096 2007-02-05 18:05 media drwxr-xr-x 2 root root 4096 2006-08-23 07:38 mnt drwxrwxrwx 2 root root 4096 2006-11-01 09:01 nt drwxr-xr-x 8 root root 4096 2007-04-08 21:36 opt dr-xr-xr-x 167 root root 0 2007-05-15 09:26 proc drwxr-xr-x 23 root root 4096 2007-05-15 18:01 root drwxr-xr-x 2 root root 8192 2007-05-06 10:30 sbin drwxr-xr-x 2 root root 4096 2006-08-23 07:38 srv drwxr-xr-x 10 root root 0 2007-05-15 09:27 sys drwxrwxrwt 17 root root 32768 2007-05-15 19:16 tmp drwxr-xr-x 12 root root 4096 2007-04-23 19:30 usr drwxr-xr-x 15 root root 4096 2006-08-23 07:38 var

A mount command shows:

/dev/sda3 on / type ext3 (rw,errors=remount-ro) proc on /proc type proc (rw) /sys on /sys type sysfs (rw) varrun on /var/run type tmpfs (rw) varlock on /var/lock type tmpfs (rw) procbususb on /proc/bus/usb type usbfs (rw) udev on /dev type tmpfs (rw) devpts on /dev/pts type devpts (rw,gid=5,mode=620) devshm on /dev/shm type tmpfs (rw) lrm on /lib/modules/2.6.15-28-386/volatile type tmpfs (rw) /dev/scd0 on /media/cdrom0 type iso9660 (ro,noexec,nosuid,nodev,user=earl) /dev/sda1 on /nt type ntfs (rw,noexec,nosuid,nodev,nls=utf8,umask=007,gid=46,user=earl)
  1. On what device is the file /nt/earl/test1.html ________________

  2. Files in /tmp are on what device? _____________________

  3. /cdrom is what kind of file? ___________________________

  4. Why does the /proc directory have a size of 0?

    _____________________________________________________

  5. What is the filesystem type of /dev/scd0? _______________________

  6. If we do the command:
    umount /dev/sda1
    
    what will happen if we do ls -l /nt?

    ______________________________________________________

  7. If the command ls /cdrom/FIRST shows:
    /cdrom/FIRST
    
    and then we do these commands, write the results of the two ls commands:
    umount /dev/scd0
    ls /cdrom/FIRST    # ____________________________________
    
    mount /dev/scd0 /mnt
    ls /mnt/FIRST      # ____________________________________
    
  8. In EXT2/EXT3, mark these data items as being in the (I)node, (D)irectory, or (G)roup Descriptor, or (S)uperblock. ___ Filename ___ Pointers to physical disk blocks containing file data ___ Number of free blocks in the file system ___ Permissions ___ INODE table ___ File owner ___ Block size ___ Time file last modified ___ Time file created ___ Time file last accessed

  9. In EXT2/3, how large is each directory entry?
    1. 32 bytes
    2. 128 bytes
    3. 1024 bytes
    4. One block depending upon block size
    5. It depends on the length of the filename.

  10. How many Superblocks are there in an EXT2/3 filesystem?
    1. 1
    2. 2
    3. One for each block group
    4. One for each file
    5. One for each directory

  11. Explain the purpose of double and triple indirection for data block pointers in the inode?

    _______________________________________________

    ________________________________________________

    ________________________________________________

  12. There is a Linux file, /proc/meminfo, which describes information about the computer memory. Where does this data actually come from when you display the file (e.g. cat /proc/meminfo)?
    1. Files on the disk which are built at boot time.
    2. Files on the disk built when the operating system was installed.
    3. Information in various kernel data structures.
    4. The inode table.
    5. The Superblock

  13. The following file listing shows a symbolic link. lrwxrwxrwx 1 earl users 26 2006-08-24 08:54 Examples -> /usr/share/example-content

    How does file management know this file is a symbolic link?

    1. By examining the actual data in the file.
    2. The directory itself says this is a link.
    3. The inode indicates that this entry is a symbolic link.
    4. The Superblock points to all symbolic links.

    The length is 26 bytes? What is this the length of?

    _________________________________________________________________

    If we rm /usr/share/examples-content, what happens if we later do: cat Examples?

    __________________________________________________

    What will an ls -l Examples show?

    __________________________________________

  14. Assume my USB port is /dev/sdb1 and I mount this:
    mount /dev/sdb1 /stick
    
    and then I copy many (containing 10Meg of data) files to the USB stick:
    cp /tmp/*.html /stick   #Wait for command to finish and prompt appears
    

    What happens if I immediately remove the USB stick?

    1. Since the command finished, the data has been written to the stick.
    2. The files may and may not be written or partially written to the stick.
    3. No files will have been written since they are not written until the stick is unmounted.
    4. A warming message will appear saying to reinsert the stick.

  15. What will happen when I do the following command right after the above cp command?
    umount /dev/sdb1
    
    1. If a sync command is not done first, the data will be lost.
    2. There may be a delay in the umount command while data is written from cache to the stick.
    3. The umount command will fail since data may still be in cache. The user must continue to do an ls comand to see when the data is written.
    4. The data on the stick will be read to verify that it matches what is in cache.

  16. What is different if after mounting the USB stick, I do these commands?
    cp /tmp/*.html /stick
    sync
    

    ______________________________________________________

  17. In Windows, when I insert a USB stick it is recognized. If I then copy many files (10 Meg of data) to the stick, what happens?
    copy /tmp/*.htm E:
    
    1. The copy command completes immediately and a popup window will inform me when the data is actually written.
    2. The data will only be written when the stick is removed.
    3. The data will be written when the user "ejects" the stick.
    4. The copy command will not complete until the data is written.
    5. The user must do a dir constantly to see when the data is written.