M01: Introduction to Operating Systems
TU1: Installing, configuring and exploiting a computer system
ASIX1
Pract. Exerc. 11: Working with File Systems 7-3-17

Practical Exercise 11:  Working with File Systems

GENERAL CONDITIONS
1- Deadline: 26-03-2017.
2- Send your report as a PDF file attached to an e-mail with the following specifications:
     a) E-mail address:
cf(at)collados.org or jordi.binefa(at)fje.edu depending who is your teacher
     b) File Name:

        b.1)
ASIX1 (Catalan): asix1_surname_name_m01tu01pr11.pdf
        b2.) DAW1 (English): daw1_surname_name_m01tu01pr11.pdf     
     c)
Subject:
         c.1)
ASIX1 (Catalan): asix1_surname_name_m01tu01pr11
         c.2)
DAW1 (English): daw1_surname_name_m01tu01pr11
3- Make this report individually.
4- Left, right, top and bottom margins: 2cm.
5- Character format: a) Font: Arial, b) Size: 10, c) Questions typeface: Bold, d) Answers typeface: Regular.

DOCUMENTATION ABOUT FILE SYSTEMS
a) Partitioning with fdisk. Installing filesystem with mkfs.
Working with fdisk -->
http://www.tldp.org/HOWTO/Partition/fdisk_partitioning.html
Working with mkfs -->http://www.computerhope.com/unix/mkfs.htm
Working with mount:
    mount  -t  filesystem  device  mountpoint
    file systems for Windows --> vfat (fat32), ntfs
    file systems for Linux --> ext2, ext3 and ext4
    file systems for CDROM/DVD --> iso9660
    device for hard disks and USB drives --> sda1, sda2,........sdb1,.....
    device for CD/DVD --> sr0,sr1,.....
    mountpoint --> Any folder on your system. Preferably in /media o /mnt
    Example 1: mount  -t  vfat  /dev/sdb1  /media/usb
   Example 2: mount  -t  iso9660  /dev/sr0  /mnt/cdrom
Working with umount:
    umount  device
    umount moutpoint
    Example 1: umount  /dev/sdb1
   
Example 2: umount  /media/usb
b) Basic ideas about file systems
Some ideas about file systems
c) Linux Drive names
http://www.palindrome.co.uk/p/a-little-about-linux-portioning.html
http://www.tldp.org/HOWTO/Partition/devices.html
d) Basic ideas about the Linux file system

General overview of Linux file system
The ext3 file system
The ext4 file system
Main characteristics of typical Linux file systems: ext2, ext3 and ext4
What is swap?
List of file systems readable by Linux

e) Linux file system management tools
Linux file system management tools
Linux file system tools-II

lsof and lsusb

PRACTICAL EXERCISE

PART 1

1.- Shutdown your system. Create a new SATA hard disk with the following characteristics:
    a) Hard drive file type: VDI
    b) Dinamically allocated
    c) Name: w7
    d) Size: 8GiB
    e)
a) Attached to  SATA 1

2-  Boot your system. Install Gparted on your system. Look for the newly installed software on Applications --> System Tools.

3.- Find information about every drive installed (mounted or not  mounted) on your system.  Find the device name for your newly installed SATA disk and its size. Check if the new hard disk has been mounted or not by the system.

4- Run  GParted and:
    a) Select
the  newly attached SATA disk.
    b) Create a new 
GPT partition table on the selected disk.
    c) Create one single partition for the full size of the selected disk.
    d) Install the NTFS file system on the  only disk partition
(Remember: Installing a file system in the Linux world = Formatting in the Windows world).

5.- Find again information about every drive installed (mounted or not  mounted) on your system . What is the difference with regard the result shown by the system in question number 3?.

6.- Display information about every partition in the newly attached hard disk, showing partitions, size, number of blocks and supposedly installed file system type.

7- List the mounted file systems on your computer. Cany you see information about the new SATA disk?. Why?. 

8.- Mount manually the NTFS file system installed on the first partition of your new SATA disk on a new directory called /mnt/finestrots. If that directory does not exist then, make it.

9.- List the mounted file system on your system the following information: a) Device file where the file system is storaged, b) File system type, c) File system size in human readable format, d) The amount of disk used and available  in human readable format and e) mounpoint (directory) connected to the file system.

10.- Change to the /mnt/finestrots directory. Create a directory called "test". Check if "test" has been succesfully created.

PART 2

1-  Donwload the following iso image:http://www.tinycorelinux.net/5.x/x86/release/Core-5.4.iso . Shutdown your system. Add the newly downloaded iso image to your system as a new IDE storage device connected to the secondary master socket.

2- Select  your hard disk as  the first boot device of your system. Boot your system again. Check if your newly connected storage device has been mounted during the boot process. If your new block device was mounted then, unmount it.

3.- Mount the file system on the CDROM on a directory called /media/core54.  If that directory does not exist then, make it.

4.- Gain access to the  file system  on the CDROM changing to /media/core_54 and make a list of its contents. Change to the directory called boot and list its contents. Copy core.gz in /mnt/finestrots/test. 

5
.- Change to
/mnt/finestrots/test. Check that core.gz has been succesfully copied.

6.- Stay in /mnt/finestrots/test. Try to unmount your NTFS file system. Can you umount the file system?. Why?.

7- Change to /mnt/finestrots. Try it again. Does it work?. Why?.

8- Change to /mnt. Try it again. Does it work?. Why?.

9.- Gain access to /media/core54. Create a directory called "test00". Has it been succesfully created. Why?. What is the message displayed by the system?

13.- Unmount the file system on your CDROM.

PART 3

1.- Display a summarized and human readable report about the file space usage of folders /home, /usr and /bin in your computer. 

2.- Display now a summarized and readable report about your home directory. Display this information in a  non summarized way. Redirect this information to a file called duhome.txt. in your home directory. Display this information in a  non summarized and non human readable way.

3.- Attach a USB drive to your system. Check that the new USB drive has been automatically mounted. Find information about: a) Device file name, b) File systems type installed on the USB drive  and the partition where have been placed , c) File system size in human readable format, d) The amount of disk used and available  in human readable format and e) mounpoint (directory) connected to the file system.

4- show information about all USB buses in the system and all devices connected to them.

5- Change to the directory where your USB drive has been mounted. Open a new terminal and
     a) L
ist all open files on the device where your USB drive was attached by the system.
     b) List all open files for you. How many files have you opened? (HELP: wc -l  prints newline counts)
     c) Look the PID number of your first bash process.
List all open files by the process. How many files have you opened?

PART 4
 
1.- Working with a USB drive:

    a) Plug an empty USB drive. Check the device file associated to the mass storage device. Check the filesystem installed.
   
    b) Unmount the USB drive.
   
    c) Delete any partition in your USB driver using fdisk
   
    d) Create two partitions (same size) in your USB drive using fdisk. The file system type for the first partition will be FAT32 type and second partition will be Linux.
   
    e) Format the first partition of your USB. The new format will be vfat.
   
   
f) Format the second partition of your USB. The new format will be ext3.
   
    g) Mount the first partition on /media/usb1
(if /media/usb1 does not exist then, make it).
   
    h)
Mount the second partition on /media/usb2 (if /media/usb2 does not exist then, make it).
   
    i) Check if both file systems have been mounted.

    j) Unmount both file systems. Return back the USB drive to its original condition.