540 likes | 672 Views
CIS 191 - Lesson 2. Storage Devices. CIS 191 - Lesson 2. Storage Devices. USB flash drive (aka pen drive). Hard drive (IDE and SCSI). Floppy drive and diskettes. CIS 191 - Lesson 2. Storage Devices. DAS – Direct Attached Storage NAS – Network Attached Storage
E N D
CIS 191 - Lesson 2 Storage Devices
CIS 191 - Lesson 2 Storage Devices USB flash drive (aka pen drive) Hard drive (IDE and SCSI) Floppy drive and diskettes
CIS 191 - Lesson 2 Storage Devices DAS – Direct Attached Storage NAS – Network Attached Storage SAN – Storage Area Networks
CIS 191 - Lesson 2 • Recognizing and specifying storage devices • IDE drives: • Primary master (/dev/hda) • Primary slave (/dev/hdb) • Secondary master (/dev/hca) • Secondary slave (/dev/hdd) • SCSI drives: • Each SCSI disk has a target id (1-7) or (1-14). (/dev/sda, /dev/sdb, ...)
CIS 191 - Lesson 2 • Recognizing and specifying storage devices • USB Flash (pen) drives: • Same device naming as SCSI drives • (can use dmesg to distinguish) • Floppies: • First drive (/dev/fd0) • Second drive (/dev/fd1) • …
CIS 191 - Lesson 2 Recognizing Storage Devices
CIS 191 - Lesson 2 • Recognizing and specifying storage devices Master IDE drive on primary One IDE drive
CIS 191 - Lesson 2 • Recognizing and specifying storage devices Master IDE drive on Secondary Master IDE drive on primary Two IDE drives
CIS 191 - Lesson 2 • Recognizing and specifying storage devices USB flash (pen) drive IDE hard drive Floppy drive
CIS 191 - Lesson 2 • Recognizing and specifying storage devices SCSI hard drive USB flash drive SCSI and USB Flash (pen) drive
CIS 191 - Lesson 2 dmesg command output Plugging in USB flash drive starts here Device identification (/dev/sdb) shows here and log ends here
CIS 191 - Lesson 2 Geometry
CIS 191 - Lesson 2 Example Physical CHS Disk Drive Geometry One head on each side of platter One sector One track 14 tracks 8 sectors per track One imaginary cylinder 3 platters 6 heads 14 cylinders size = cylinders x heads x sectors per track x 512 bytes size = 14 x 6 x 8 x 512 = 344,064 bytes
CIS 191 - Lesson 2 Disk Drive Geometry • Times have changed! • Disk drives are no longer limited to 1024 cylinders (old BIOS restriction) • Modern track density has hit over tens of thousands of tracks per inch (the old 3.5”diskette had 80 per side) • Zone bit recording places more sectors per track on outside tracks. E.g. A IBM 34.2 GB Deskstar has 272 to 452 sectors per track. • NOTE: The OS uses logical disk geometry which does not match physical disk geometry. • Modern drives use Logical Block Addressing (LBA) rather than the old CHS addressing.
CIS 191 - Lesson 2 Disk Drive Geometry physical ≠ logical Modern drives have variable number of sectors per track. It is not possible to represent their full capacity using the old CHS method. The BIOS shows 16 logical heads and 63 logical sectors per track and adjust the number of logical cylinders to approximate the full capacity. The OS fdisk shows 255 logical heads and 63 logical sectors per track and then adjusts logical cylinders accordingly. Disk /dev/hda: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
CIS 191 - Lesson 2 Disk sizes (fdisk command) 5GB VMWare Drive 5 x 1024 x 1024 x 1024 = 5,368,709,120 bytes 255 heads x 63 sectors/track x 652 cylinders x 512 bytes = 5,362,882,560 bytes NOTE This is logical (not physical) disk geometry Blocks (1 block = 1024 bytes) Cylinders
CIS 191 - Lesson 2 Disk sizes (df command) 3,5266,204 x 1000 x (1000/1024) = 3,443,558,594 bytes = 3.4 GB 101,107 x 1000 x (1000/1024) = 98,737,304 bytes = 99 MB NOTE: 1 computer KB = 1,024 bytes (2 to the 10th power) 1 human KB = 1,000 bytes
CIS 191 - Lesson 2 Disk Partitions
CIS 191 - Lesson 2 Setting up Hard Drives Step 1 – Add hard drive to computer Free Space • Add the hard drive: • Low-level formatting has already been done at the factory (lays out the physical tracks and sectors). • There are no partitions yet. • There are no file systems yet. Note: Floppies, unlike hard drives, can be low-level formatted with the fdformat command
CIS 191 - Lesson 2 Setting up Hard Drives Step 2 - Partition the hard drive Master Boot Record (MBR) • Partition the hard drive: • The MBR is on the very first sector and is 512 bytes long. • The first 446 bytes of the MBR gets system boot code. • The next 64 bytes of the MBR gets the partition table. • The last 2 bytes are marked 0xAA55. Partition Boot Sector Data Partition Boot Sector Data Free Space
CIS 191 - Lesson 2 Setting up Hard Drives Step 2 - Partition the hard drive Master Boot Record (MBR) The MBR partition table records the location, status and type of each primary partition. Partition Boot Sector Data • Primary • partition Partition Boot Sector Data Primary partition Free Space Each added partition has its own boot sector at the beginning.
CIS 191 - Lesson 2 Setting up Hard Drives Step 2 - Partition the hard drive Master Boot Record (MBR) Partition Boot Sector Data • Primary • partition Partition Boot Sector Primary partition The maximum number of primary partitions is four. Data Partition Boot Sector • Primary • partition Data Partition Boot Sector Primary partition Data
CIS 191 - Lesson 2 Setting up Hard Drives Step 2 - Partition the hard drive Master Boot Record (MBR) One of the four primary partitions can be an extended partition An extended may contain an arbitrary number of logical partitions Partition Boot Sector • Primary • partition Data Partition Boot Sector Primary partition Data Partition Boot Sector • Primary • partition Data Partition Boot Sector Unused Boot Sector Logical partition Data Extended partition Unused Boot Sector Logical partition Data
CIS 191 - Lesson 2 Setting up Hard Drives Step 3 – Add file systems to partitions Master Boot Record (MBR) Partition Boot Sector ext2 file system Data Superblock Partition Boot Sector Inode Table Data Partition Boot Sector Data Partition Boot Sector Unused Boot Sector Data Blocks Data Unused Boot Sector Data
CIS 191 - Lesson 2 fdisk and mount Show current partitions and their usage Master Boot Record (MBR) Partition Boot Sector /dev/sda1 /boot Partition Boot Sector /dev/sda2 / Partition Boot Sector /dev/sda3 swap Partition Boot Sector Unused Boot Sector /dev/sda4 /dev/sda5 /home Free Space
CIS 191 - Lesson 2 Specifying partitions Partitions are labeled by Linux as the drive name following by a number. The numbers 1-4 are reserved for the first four primary partitions. 5 or higher indicates it is a logical partition. Examples: /dev/hda1 = first partition (primary) on the primary master IDE drive. /dev/sdb3 = third partition (primary) on the second SCSI drive. /dev/sda5 = fifth partition (logical partition) on the first SCSI drive.
CIS 191 – Lesson 2 Specifying partitions Add 1 primary and 1 extended to new drive [root@rh9 root]# fdisk -l Disk /dev/sda: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 332 2562367+ 83 Linux /dev/sda3 333 365 265072+ 82 Linux swap /dev/sda4 366 652 2305327+ 5 Extended /dev/sda5 366 492 1020096 83 Linux /dev/sda6 493 505 104391 83 Linux Disk /dev/sdb: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table [root@rh9 root]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) Command (m for help): /dev/sda has been partitioned already. /dev/sdb has not been partitioned yet.
CIS 191 – Lesson 2 Specifying partitions Add 1 primary and 1 extended to new drive Command (m for help): n Command action e extended p primary partition (1-4) e Partition number (1-4): 1 First cylinder (1-261, default 1): 1 Last cylinder or +size or +sizeM or +sizeK (1-261, default 261): 50 Command (m for help): n Command action l logical (5 or over) p primary partition (1-4) l First cylinder (1-50, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-50, default 50): 10 Command (m for help): p Disk /dev/sdb: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sdb1 1 50 401593+ 5 Extended /dev/sdb5 1 10 80262 83 Linux Command (m for help): MBR Boot Sector /dev/sdb5 Unused /dev/sdb1 Free Note: The second partition added is number 5 because it is in an extended partition. Numbers 1-4 are reserved for the four primary partitions.
CIS 191 - Lesson 2 fdisk Partition Utility – (n)ew and (p)rint [root@rh9 root]# fdisk /dev/sda Command (m for help): n First cylinder (493-652, default 493): Using default value 493 Last cylinder or +size or +sizeM or +sizeK (493-652, default 652): +100M Command (m for help): p Disk /dev/sda: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 332 2562367+ 83 Linux /dev/sda3 333 365 265072+ 82 Linux swap /dev/sda4 366 652 2305327+ 5 Extended /dev/sda5 366 492 1020096 83 Linux /dev/sda6 493 505 104391 83 Linux Command (m for help): MBR /dev/sda1 Boot Sector /boot /dev/sda2 Boot Sector / /dev/sda3 Boot Sector swap Boot Sector /dev/sda5 Unused /home /dev/sda4 /dev/sda6 Unused Free Space
CIS 191 - Lesson 2 fdisk Partition Utility – (m)enu of commands Command (m for help): m Command action a toggle a bootable flag b edit bsddisklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help): MBR /dev/sda1 Boot Sector /boot /dev/sda2 Boot Sector / /dev/sda3 Boot Sector swap Boot Sector /dev/sda5 Unused /home /dev/sda4 /dev/sda6 Unused Free Space
CIS 191 - Lesson 2 fdisk Partition Utility – (w)rite out partition table Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. Syncing disks. [root@rh9 root]# partprobe MBR /dev/sda1 Boot Sector /boot /dev/sda2 Boot Sector / /dev/sda3 Boot Sector swap Boot Sector Use partprobe to update the kernel without rebooting. This is required if you want to mount a new partition. /dev/sda5 Unused /home /dev/sda4 /dev/sda6 Unused Free Space
CIS 191 - Lesson 2 fdisk Partition Utility – the l option MBR /dev/sda1 [root@rh9 root]# fdisk -l Disk /dev/sda: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 332 2562367+ 83 Linux /dev/sda3 333 365 265072+ 82 Linux swap /dev/sda4 366 652 2305327+ 5 Extended /dev/sda5 366 492 1020096 83 Linux /dev/sda6 493 505 104391 83 Linux Boot Sector /boot /dev/sda2 Boot Sector / /dev/sda3 Boot Sector swap Boot Sector /dev/sda5 Unused /home /dev/sda4 /dev/sda6 Unused Free Space
CIS 191 - Lesson 2 Making File Systems
CIS 191 - Lesson 2 dd command (continued) Reading and writing directly to a drive [root@rh9 root]# fdisk -l Disk /dev/sda: 5368 MB, 5368709120 bytes 255 heads, 63 sectors/track, 652 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 332 2562367+ 83 Linux /dev/sda3 333 365 265072+ 82 Linux swap /dev/sda4 366 652 2305327+ 5 Extended /dev/sda5 366 492 1020096 83 Linux /dev/sda6 493 505 104391 83 Linux Disk /dev/sdb: 2147 MB, 2147483648 bytes 255 heads, 63 sectors/track, 261 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table [root@rh9 root]# echo "Rich was here" > /dev/sdb [root@rh9 root]# xxd /dev/sdb | more 0000000: 5269 6368 2077 6173 2068 6572 650a 0000 Rich was here... 0000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................ < snipped >................ 0000150: 0000 0000 0000 0000 0000 0000 0000 0000 ................ [root@rh9 root]# /dev/sdb is a newly added un-partitioned drive You can write and read to the drive however it is very clumsy compared to using a file system* *Never do this to a drive containing important data
CIS 191 - Lesson 2 dd command (continued) Reading and writing directly to a partition /dev/sdb6 is a newly added, un-mounted partition on /dev/sda [root@rh9 root]# echo "Rich was here too" > test [root@rh9 root]# wc -c test 18 test [root@rh9 root]# [root@rh9 root]# dd if=test of=/dev/sda6 bs=1 count=18 18+0 records in 18+0 records out [root@rh9 root]# dd if=/dev/sda6 bs=1 count=18 Rich was here too 18+0 records in 18+0 records out [root@rh9 root]# [root@rh9 root]# xxd /dev/sda6 | more 0000000: 5269 6368 2077 6173 2068 6572 6520 746f Rich was here to 0000010: 6f0a 0000 0000 0000 0000 0000 0000 0000 o............... 0000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................ < snipped > [root@rh9 root]# dd if=/dev/zero of=/dev/sda6 bs=1 count=18 18+0 records in 18+0 records out [root@rh9 root]# xxd /dev/sda6 | more 0000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................ < snipped > We can also write and read directly to the partition.* /dev/zero has an unlimited numbers of binary zeros. Can be used to zero out a partition or drive.* *Never do this to a partition containing important data
CIS 191 - Lesson 2 Adding File Systems Superblock Inode Table Analogy: making a file system on an empty partition is like painting the stripes on a parking lot. It organizes the space and makes it efficient. Data Blocks ext2 file system
CIS 191 - Lesson 2 Adding File Systems mkfs –t ext2 /dev/sda6 MBR /dev/sda1 Boot Sector /boot Superblock /dev/sda2 Boot Sector Inode Table / /dev/sda3 Boot Sector swap Boot Sector Unused /dev/sda5 Data Blocks /home /dev/sda4 /dev/sda6 Unused Free Space
CIS 191 - Lesson 2 mkfs command • mkfs –t typedevice • -t ext2 • –t ext3 (has journaling) • -t vfat (compatible with Windows) • -t jfs (IBM’s journaled file system) • -t reiserfs • For ext2 or ext3 use: • -N option to specify number of inodes • -m option to specify % blocks reserved for superuser (default 5%) • -L option to set the volume label for the file system • Example: mkfs –t ext3 /dev/sda6 • (puts ext3 file system on 6th partition of 1st SCSI drive) • Example: mkfs –t ext2 –m 0 –N 1000 –L myfiles /dev/sda6 • (puts ext2 file system with 1000 inodes, no space reserved for superuser, volume label “myfiles” on 6th partition of 1st SCSI drive, ) • Note: mkfs is actually a front end for various file systems builders. • [root@rh9 root]# ls /sbin/mkfs* • /sbin/mkfs /sbin/mkfs.ext2 /sbin/mkfs.jfs /sbin/mkfs.reiserfs • /sbin/mkfs.cramfs /sbin/mkfs.ext3 /sbin/mkfs.msdos /sbin/mkfs.vfat
CIS 191 - Lesson 2 • File Systems • FAT32 file system [root@partide root]# fdisk -l /dev/sda Disk /dev/sda: 999 MB, 999816704 bytes 4 heads, 8 sectors/track, 61023 cylinders Units = cylinders of 32 * 512 = 16384 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 61024 976379+ b Win95 FAT32 [root@partide root]# [root@partide root]# umount /mnt [root@partide root]# mount /dev/sda1 /mnt [root@partide root]# ls -l /mnt total 713064 -rwxr-xr-x 1 root root 730177536 Mar 23 23:18 KNOPPIX_V5.1.1CD-2007-01-04-EN.iso [root@partide root]# This pen drive works with Windows or Linux
CIS 191 - Lesson 2 ext2 file system • Superblock has: • File system type, label, inode count, block count, etc. about entire file system. • Redundant copies are maintained. • Use: dumpe2fs –h /dev/sda2 • to see / superblock info on rh9 VM • inodes have: • file type, permissions, link count, owner, group, size, major and minor numbers, creation date, modification date, access date, pointers to data blocks. • Does not contain filenames which are kept in directories. • Use stat command to see inode information • Data blocks have actual file and directory data. ext2 file system Superblock Inode Table Data Blocks
CIS 191 - Lesson 2 bigfile 102574 bin 102575 letter 102609 102609 inode number ext2 file system Superblock - Type rw-r—r-- Permissions Hello Mother! Hello Father! Here I am at Camp Granada. Things are very entertaining, and they say we'll have some fun when it stops raining. All the counselors hate the waiters, and the lake has alligators. You remember Leonard Skinner? He got ptomaine poisoning last night after dinner. Now I don't want this to scare you, but my bunk mate has malaria. You remember Jeffrey Hardy? Their about to organize a searching party. Take me home, oh Mother, Father, take me home! I hate Granada. Don't leave me out in the forest where I might get eaten by a bear! Take me home, I promise that I won't make noise, or mess the house with other boys, oh please don't make me stay -- I've been here one whole day. Dearest Father, darling Mother, how's my precious little brother? I will come home if you miss me. I will even let Aunt Bertha hug and kiss me! Wait a minute! It's stopped hailing! Guys are swimming! Guys are sailing! Playing baseball, gee that's better! Mother, Father, kindly disregard this letter. Alan Sherman Inode Table 1 Number of links simmsben User cis90 Group Data Blocks 1044 Size 2001-07-20 Modification time 2008-08-08 Access Time 2008-06-20 Change time Pointer(s) to data blocks Pointer(s) to data blocks [simmsben@opus ~]$ls -il letter 102609 -rw-r--r-- 1 simmsben cis90 1044 Jul 20 2001 letter
CIS 191 - Lesson 2 ext2 file system Using dumpe2fs –h to show superblock information [root@rh9 root]# dumpe2fs -h /dev/sda2 dumpe2fs 1.32 (09-Nov-2002) Filesystem volume name: / Last mounted on: <not available> Filesystem UUID: b552eed8-4c9d-4f8f-9edf-dd76037f82bd Filesystem magic number: 0xEF53 Filesystem revision #: 1 (dynamic) Filesystem features: has_journal filetype needs_recovery sparse_super Default mount options: (none) Filesystem state: clean Errors behavior: Continue Filesystem OS type: Linux Inode count: 320640 Block count: 640591 Reserved block count: 32029 Free blocks: 228375 Free inodes: 220820 First block: 0 Block size: 4096 Fragment size: 4096 Blocks per group: 32768 Fragments per group: 32768 Inodes per group: 16032 Inode blocks per group: 501 Filesystem created: Fri Jul 18 09:37:33 2008 Last mount time: Fri Jul 18 17:06:16 2008 Last write time: Fri Jul 18 17:06:16 2008 Mount count: 3 Maximum mount count: -1 Last checked: Fri Jul 18 09:37:33 2008 Check interval: 0 (<none>) Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal UUID: <none> Journal inode: 8 Journal device: 0x0000 First orphan inode: 229443 [root@rh9 root]# If you leave off the –h option you will also see the data block status as well.
CIS 191 - Lesson 2 ext2 file system Using stat command to show Inode details [root@rh9 root]# ls anaconda-ks.cfg install.log install.log.syslog test testdir [root@rh9 root]# ls -l total 36 -rw-r--r-- 1 root root 1220 Jul 18 16:57 anaconda-ks.cfg -rw-r--r-- 1 root root 19626 Jul 18 16:51 install.log -rw-r--r-- 1 root root 2895 Jul 18 16:51 install.log.syslog -rw-r--r-- 1 root root 18 Jul 18 17:24 test drwxr-xr-x 2 root root 4096 Jul 20 18:41 testdir [root@rh9 root]# stat test testdir File: `test' Size: 18 Blocks: 8 IO Block: 4096 Regular File Device: 802h/2050d Inode: 37058 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2008-07-20 18:40:47.000000000 -0700 Modify: 2008-07-18 17:24:47.000000000 -0700 Change: 2008-07-18 17:24:47.000000000 -0700 File: `testdir' Size: 4096 Blocks: 8 IO Block: 4096 Directory Device: 802h/2050d Inode: 20964 Links: 2 Access: (0755/drwxr-xr-x) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2008-07-20 18:41:08.000000000 -0700 Modify: 2008-07-20 18:41:08.000000000 -0700 Change: 2008-07-20 18:41:08.000000000 -0700 [root@rh9 root]# Note: The name of the file is not kept in the Inode. It is kept as data in a directory file.
CIS 191 - Lesson 2 ext2 file system lost+found directory [root@rh9 root]# mkfs -t ext2 /dev/sda6 mke2fs 1.32 (09-Nov-2002) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 26104 inodes, 104391 blocks 5219 blocks (5.00%) reserved for the super user First data block=1 13 block groups 8192 blocks per group, 8192 fragments per group 2008 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 21 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@rh9 root]# mount /dev/sda6 /mnt [root@rh9 root]# ls /mnt lost+found [root@rh9 root]# ls -l /mnt total 12 drwx------ 2 root root 12288 Jul 21 08:22 lost+found [root@rh9 root]# Note: The lost+found directory is created when you make a ext2 or ext3 file system. This is where the fsck utility will place any recovered data it finds when checking a file system. Don’t delete it!
CIS 191 - Lesson 2 Mounting File Systems
CIS 191 - Lesson 2 Mounting File Systems • Mounting and Un-mounting file systems • mount [device-file] [directory] • umount [device-file | directory] • Mount information • /etc/fstab (what to mount at boot time) • /etc/mtab (current mount status)
CIS 191 - Lesson 2 Showing current mount status On the rh9 VM mount command with no arguments shows current mount status in /etc/mtab / [root@rh9 root]# mount /dev/sda2 on / type ext3 (rw) none on /proc type proc (rw) /dev/sda1 on /boot type ext2 (rw) none on /dev/pts type devpts (rw,gid=5,mode=620) /dev/sda5 on /home type ext3 (rw) none on /dev/shm type tmpfs (rw) [root@rh9 root]# cat /etc/mtab /dev/sda2 / ext3rw 0 0 none /proc procrw 0 0 /dev/sda1 /boot ext2 rw 0 0 none /dev/pts devptsrw,gid=5,mode=620 0 0 /dev/sda5 /home ext3 rw 0 0 none /dev/shmtmpfsrw 0 0 [root@rh9 root]# [root@rh9 root]# ls -F /home /boot /mnt /boot: boot.bkernel.h module-info-2.4.20-6 vmlinuz@ chain.blost+found/ os2_d.b vmlinuz-2.4.20-6 config-2.4.20-6 message System.map@ grub/message.ja System.map-2.4.20-6 initrd-2.4.20-6.img module-info@ vmlinux-2.4.20-6 /home: lost+found/ rsimms/ /mnt: cdrom/ floppy/ hgfs/ [root@rh9 root]# /bin /boot /grub /dev/sda1 /lost+found /dev/sda2 /etc /dev/sda5 /dev /dev/sda6 /home /rsimms /lost+found /mnt /cdrom /floppy /hgfs
CIS 191 - Lesson 2 Making a file system and mounting it On the rh9 VM / [root@rh9 root]# mkfs -t ext3 /dev/sda6 mke2fs 1.32 (09-Nov-2002) Filesystem label= OS type: Linux Block size=1024 (log=0) Fragment size=1024 (log=0) 26104 inodes, 104391 blocks 5219 blocks (5.00%) reserved for the super user First data block=1 13 block groups 8192 blocks per group, 8192 fragments per group 2008 inodes per group Superblock backups stored on blocks: 8193, 24577, 40961, 57345, 73729 Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 39 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override. [root@rh9 root]# mount /dev/sda6 /mnt [root@rh9 root]# cd /mnt [root@rh9 mnt]# mkdir dir1 dir2 [root@rh9 mnt]# ls dir1 dir2 lost+found [root@rh9 mnt]# cd [root@rh9 root]# ls /mnt dir1 dir2 lost+found [root@rh9 root]# umount /mnt [root@rh9 root]# ls /mnt cdrom floppy hgfs [root@rh9 root]# /bin /boot /grub /dev/sda1 /lost+found /dev/sda2 /etc /dev/sda5 /dev /dev/sda6 /home /rsimms /lost+found /mnt mount will overlay the new files ystem on a directory in the current file hierarchy. The old directory is no longer accessible until the new one is un-mounted /dir1 /fdir2 /lost+found
Mounting File Systems Like pinning the tail on the donkey mount /dev/sda6 /mnt / /bin /boot /etc /dev /home /lib /mnt /lost+found /cdrom /rsimms /floppy /lost+found /dev/sda5 /hgfs /grub /dev/sda1 /dir1 /fdir2 /lost+found /dev/sda6
Mounting File Systems Like pinning the tail on the donkey mount /dev/sda6 /mnt / /bin /boot /etc /dev /home /lib /mnt /lost+found /dir1 /dir2 /rsimms /lost+found /lost+found /dev/sda5 /grub /dev/sda6 /dev/sda1