Difference between revisions of "OPS235 Lab 1 - Fedora17"
Brian.gray (talk | contribs) |
Brian.gray (talk | contribs) (→Investigation 3: How do you create an ext3 filesystem on a USB flash drive with a volume label?) |
||
Line 98: | Line 98: | ||
#* How many blocks were created? | #* How many blocks were created? | ||
#* How often will the new filesystem be automatically checked? | #* How often will the new filesystem be automatically checked? | ||
− | #* What volume label was given to the filesystem? | + | #* What volume label was given to the filesystem?{{Admon/tip | Tip: | Check the man page for <code>dumpe2fs</code>.}} |
− | {{Admon/tip | Tip: | Check the man page for <code>dumpe2fs</code>.}} | ||
# According to the man page what is the purpose of dumpe2fs? | # According to the man page what is the purpose of dumpe2fs? | ||
# If you executed dumpe2fs on an MS-DOS filesystem what do you think would be the result? | # If you executed dumpe2fs on an MS-DOS filesystem what do you think would be the result? |
Revision as of 14:39, 8 January 2010
Contents
Using Linux to Access Block Devices and Filesystems
Objectives
- Format, mount, use, and unmount ext3, ext4, and vfat filesystems on USB flash drives.
- Create filesystems on various storage devices
- Create hard disk partitions
- Backup filesystems and images
- Mount a filesystem stored within a a regular file
Reference
- man pages for cp, mount, umount, fdisk, mkdir, file, mkfs, dumpe2fs, grep, dd
- Online reading material for weeks 1 and 2.
Required materials
- Fedora 12 Live CD
- USB flash drive, 64 MB or more in size (Warning: the contents of this drive will be erased)
- One SATA hard disk in a removable drive tray (minimum 80GB)
Instructions
- Set your computer's drive selector switch to external, then power up the computer.
- Insert the Fedora Live CD into the CD/DVD drive.
- Reboot the system.
- The boot process is completed when you see the GDM Login Screen. Click on "Automatic Login" to login as the "Live System User".
- We are going to start by opening a terminal window to access our shell environment. Click on Applications --> System Tools --> Terminal to start the terminal.
- At the top of the terminal window, you should see the command prompt similar to [liveuser@localhost ~]$ This prompt indicates that it is ready to take your command. The program that is running is called a shell.
- At the command prompt, enter the command whoami (all in one word) and press return. This command shows the so-called User Name. Make notes of this user name.
- At the command prompt, enter the command pwd and press return. This command shows the so-called present working directory or current working directory. Record the present working directory of the shell running on the terminal window. As we have not yet changed directories this should also be your users home directory. (Also indicated by the ~ character in the prompt)
Investigation 1: How does Linux enable you to access two different drives without using a drive designator?
- Type the command mount. Describe the output of the command in your lab log. What do the fields of data represent? Use the man page for the mount command and google searches to find this information
- Insert your USB flash drive into a USB port on the computer.
- Because we have turned off the automatic mounting feature nothing will happen. In order to access the file system on this storage device we must mount it on to our existing file/directory structure.
- To mount a device we must first create a mount point to mount it on. Create a new directory called
/media/usb
(These steps should be done as "root") - Next we need to use the mount command to mount the device. Try typing the following command:
mount -t vfat /dev/sdb1 /media/usb
. This command contains 3 important pieces of information (command arguments):-
-t vfat
tells the mount command to mount it as a FAT filesystem. (Most likely choice for a USB flash drive) -
/dev/sdb1
tells the mount command which device to mount. (If this didn't work try/dev/sdc1
or/dev/sda1
) -
/media/usb
tells the mount command where to mount the device (the "mount point")
-
- Type the command mount and compare the output with the output from step 9. Record what has changed.
- What file system type is the USB device mounted as? Where was it mounted? What is the device name?
- Create a file in the directory /media/usb/ by redirecing the output of the cal command: cal >/media/usb/month
- Display a detailed listing of the directory where the device is mounted and record the output: ls -l /media/usb
- Type the command umount /media/usb -- What happened to the contents of the /media/usb directory? Compare results with step 17.
- Type the command mount and observe the output. What is different from step 14? Why?
- Make a new mount point called /media/usb2 Mount your usb flash drive on the new mount point.
- Display a detailed listing of the new mount point again. Is your file there?
Answer the Investigation 1 question: How does Linux enable you to access two different drives without using a drive designator? (Write the answer in your lab log book).
Investigation 2: How do you create a vfat or ext3 filesystem?
- Unmount your USB flash drive.
- Enter the command:
mkfs -t ext3 /dev/sdb1
- What is the purpose of this command? Use the man page for mkfs to research what you did with this command.
- Did we execute the command on the device name or the mount point?
- Attempt to mount the USB flash drive using the command you used in Investigation 1. What was the result?
- Check the man page for the mount command to see how to change your command to mount the device correctly, and issue that command.
- Once the device is mounted do a long directory listing of the mount point. What has changed?
- Do an internet search to find out what the
lost+found
directory is for. Record your findings in your notes. - Create a new file on the device using the same technique used in Investigation 1.
- Unmount the device and remount it on the original mount point. Is the new file there?
- Type the command mount and observe the type value for the USB flash drive filesystem. Compare this value to the type found in Investigation 1.
- Change your current working directory to where the device is mounted.
- Attempt to unmount the USB flash drive. What was the result? Why? Record your findings in your notes.
- Solve the error and unmount the device.
- Consult the man pages for
mkfs
andmkfs.ext3
to see how to reformat the device to a ext3 file system with a volume label that is the same as your learn ID. - Enter the command to reformat the device.
- The
dumpe2fs /dev/sdb1
command will allow us to see detailed information about ext3 filesystems. Use it to confirm your volume label is correct and record the size of your journal. - Mount the device again as an ext3 filesystem.
- While the device is still mounted reformat the device as a vfat filesystem. What error message did you receive? Why? Record your conclusions in your notes.
- Unmount the device and format it as vfat.
- Now you will investigate what happens when you copy files to the device name rather than the mount point. Issue the command cp /etc/hosts /dev/sdb1
- Now mount your device. Was it successful? Try mounting it as ext3. Was it successful? What has happened to the filesystem on the device?
- Reformat it as vfat and mount it.
- Unmount the device.
Investigation 3: How do you create an ext3 filesystem on a USB flash drive with a volume label?
- Shutdown your computer. (Under the "System" menu)
- Insert your removable SATA hard disk, remove your USB flash drive and restart the computer. (Leave your "Live CD" in the computer)
- When the computer has restarted and you have logged in. Insert your USB flash drive into the USB port.
- Open a terminal window and run the
mount
command. - It is quite possible that the device name for your USB flash drive has changed from what you were using previously. Your hardware configuration is different because now you have a hard drive connected. One way to determine what your USB device name is now is to look at the system log. Use the tail command to view the last 20 lines of the file
/var/log/messages
There should be kernel entries that were generated when you inserted the device. - Create a Linux ext3 filesystem on the USB device, giving it a volume label of "Lab1", and record the following in in your logbook:
- What is the block size for the new format?
- How many blocks were created?
- How often will the new filesystem be automatically checked?
- What volume label was given to the filesystem?
- According to the man page what is the purpose of dumpe2fs?
- If you executed dumpe2fs on an MS-DOS filesystem what do you think would be the result?
- Mount the USB device onto the mount point /media/lab1
Completing the Lab
Arrange evidence of each of the following items on the screen, and then ask your professor or lab monitor to check them:
- USB Formatted as ext2 ( )
- Volume Label is "LAB1" ( )
- USB Mounted on
/media/lab-one
( ) - Following files on USB services, issue, networks ( )
- Instructor satisfied with complete and detailed lab notes ( )
Preparing for the Quizzes
The online readings linked on the course web page contain some useful information about Free and Open Source Software. Use them and Internet searches to answer the following questions to help you prepare for the quizzes:
- Who is Linus Torvalds?
- Name 3 open source software projects widely used today?
- What license agreement does GNU/Linux use?
- What are the 4 basic software freedoms that define "Free Software"?
- Who makes up the Fedora Community?
- Name 4 other significant Linux "Distros"