HW 5,7
|
[IFT 201] |
Computer and Network Systems: Organization and Administration |
Lab 7: Managing Information Storage in Linux – 50 pts
Introduction
Managing information storage requires you to understand the layout of standard files and directories in the UNIX system, how files and directories are related to file systems, and the relation between file systems and storage media (such as hard disks).
Most users see stored information on a UNIX system as a collection of files and directories, largely independent of particular devices or media. An administrator must view these files and directories as a set of file systems that are connected to storage media.
The most typical storage devices on UNIX systems are floppy disks, hard disks, tapes, and CD-ROMs/DVDs.
Part 1: Activities
Use the command script lab7.1 to capture your work on this part. Be sure to exit when you’re done.
UNIX File Systems
By default UNIX have only 3 types of files:
· Regular files
· Directory files
· Special files: There are 5 types of special files:
· Block file b)
· Character device file (c)
· Named pipe file or just a pipe file (p)
· Symbolic link file (l)
· Socket file (s)
When you receive your computer, the hard disks are probably already formatted into addressable sectors called blocks , which are usually 512 bytes each in size. Once UNIX is installed, the disks are divided into sections or partitions , each of which contains some number of these blocks. Each file system is assigned one of these partitions as the area where information for that file system is stored.
Devices
The interface to each disk partition is through device-special files in the /dev directory. General users never bother with a file system’s /dev interface. You should be aware of these device-special files if you are administering a system, however. Device names may be needed to do administrative tasks, such as changing disk partitioning and doing backups.
Hard disks are considered block devices: They read and write data of fixed block sizes, typically 512 bytes. However, there is usually a character (or raw) device interface as well as a block device interface. Character devices read and write information one character at a time. Block devices start with the letter b, and character devices begin with the letter c.
To check the file types in a given directory, say /dev, use “ls –l” and check the first character of each output line
$ ls -l /dev
total 0
crw-rw---- 1 root video 10, 175 Sep 18 2015 agpgart
crw------- 1 root root 10, 235 Sep 18 2015 autofs
drwxr-xr-x 2 root root 640 Sep 18 2015 block
drwxr-xr-x 2 root root 80 Sep 18 2015 bsg
crw------- 1 root root 10, 234 Sep 19 2015 btrfs-control
lrwxrwxrwx 1 root root 3 Sep 18 2015 cdrom -> sr0
drwxr-xr-x 2 root root 3220 Sep 19 2015 char
crw------- 1 root root 5, 1 Sep 18 2015 console
You can use the command grep to filter the output. For example, to print only directory files, you will use the command $ ls –l | grep ‘^b’
1. Run the command above to list ALL the files (and their file types) in your system /dev directory
2. Print ONLY block devices
3. Print ONLY character devices
The Linux File System Type
Naming conventions for device names vary among UNIX systems. Linux uses about a dozen file system types. The most common is the ext2 file system, which is the standard one. It supports both large file sizes and large filenames. Some of the more often used ones include the msdos file system (used for MS-DOS file partitions), the vfat and the ntfs file systems (used for Windows 98/NT files), the proc file system (used for system processes), the NFS file system (used for remote mounting), and the swap file system (used for swap partitions and swap files).
4. Type the command below to display filesystems currently in use on your system.
$ cat /proc/filesystems
5. Type the command below to report filesystem disk space usage. (-k reports in Kbytes)
$ df -k
IDE drives are referred to as hda (/dev/had) for the first drive, hdb (/dev/hdb) for the second drive, etc.
SCSI disks are labelled sda (/dev/sda), sdb (/dev/sdb), etc.
Use the command cat /proc/partitions to see full list of disks and partitions that your system can see.
$ cat /proc/partitions
major minor #blocks name
11 0 63266 sr0
8 0 209715200 sda
8 1 205520896 sda1
8 2 1 sda2
8 5 4191232 sda5
6. Print the full list of disks and partitions on your system.
Mounting/unmounting File Systems
Mounting is the action that attaches a file system to the directory structure. You can mount a file system directly from the shell or have the file system mounted automatically when your computer starts up. You might be more likely to mount a disk on demand using the mount command, whereas you might want a hard disk file system to be mounted automatically. The directory that is to be associated with the device that you mount is known as the mount point .
For example, to mount a CD-ROM on Linux, you use: mount /mnt/cdrom.
To detach the file system from the directory structure, you must unmount it, using the umount command.
7. Type the command below to display all mounted devices, their mount point, filesystem, and access.
$ mount
8. Type the command below to display mounted filesystems currently in use.
$ cat /proc/mounts
Memory Usage
9. Type the command below to monitor virtual memory
$ vmstat
10. Type the command below to view system memory limits:
$ grep MemTotal /proc/meminfo
11. Type the command below to display the amount of free and used memory in your system
$ free
Part 2: Report
Write a 1-paragraph report providing the following information about the UNIX/Linux system you are using, and how you used the concepts from this lab to find out:
· Memory capacity, in GB
· How much free, used, and cache size, all in GB
· Your hard disk partitions and associated number of blocks
Save your file as lab7.2.xxx (where xxx is the extension for the program you’re using (e.g. .txt). If don’t use MS Word or Notepad or WordPad (for example, if you use Mac), please submit a PDF document.
Part 3: Submission
1. Zip lab7.1 and lab7.2 into a single file called lab7.zip.
2. Be sure to include your full name on every page. You can insert it in the header, above the “IFT 201” banner.
3. Upload your file to Blackboard.
Page 2