Presentation is loading. Please wait.

Presentation is loading. Please wait.

CIS 191 - Lesson 2 Storage Devices. CIS 191 - Lesson 2 Floppy drive and diskettes Hard drive (IDE and SCSI) USB flash drive (aka pen drive) Storage Devices.

Similar presentations


Presentation on theme: "CIS 191 - Lesson 2 Storage Devices. CIS 191 - Lesson 2 Floppy drive and diskettes Hard drive (IDE and SCSI) USB flash drive (aka pen drive) Storage Devices."— Presentation transcript:

1 CIS 191 - Lesson 2 Storage Devices

2 CIS 191 - Lesson 2 Floppy drive and diskettes Hard drive (IDE and SCSI) USB flash drive (aka pen drive) Storage Devices

3 CIS 191 - Lesson 2 DAS – Direct Attached Storage NAS – Network Attached Storage SAN – Storage Area Networks Storage Devices

4 CIS 191 - Lesson 2 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,...) Recognizing and specifying storage devices

5 CIS 191 - Lesson 2 USB Flash (pen) drives: Same device naming as SCSI drives (can use dmesg to distinguish) Floppies: First drive (/dev/fd0) Second drive (/dev/fd1) … Recognizing and specifying storage devices

6 CIS 191 - Lesson 2 Recognizing Storage Devices

7 CIS 191 - Lesson 2 Master IDE drive on primary One IDE drive Recognizing and specifying storage devices

8 CIS 191 - Lesson 2 Master IDE drive on Secondary Two IDE drives Recognizing and specifying storage devices Master IDE drive on primary

9 CIS 191 - Lesson 2 USB flash (pen) drive IDE hard drive Floppy drive Recognizing and specifying storage devices

10 CIS 191 - Lesson 2 SCSI hard drive USB flash drive SCSI and USB Flash (pen) drive Recognizing and specifying storage devices

11 CIS 191 - Lesson 2 dmesg command output Plugging in USB flash drive starts here Device identification (/dev/sdb) shows here and log ends here

12 CIS 191 - Lesson 2 Geometry

13 14 tracks 8 sectors per track CIS 191 - Lesson 2 Example Physical CHS Disk Drive Geometry One sector One track 3 platters 6 heads 14 cylinders One imaginary cylinder One head on each side of platter size = cylinders x heads x sectors per track x 512 bytes size = 14 x 6 x 8 x 512 = 344,064 bytes

14 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.5diskette 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.

15 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

16 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 Cylinders Blocks (1 block = 1024 bytes)

17 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 10 th power) 1 human KB = 1,000 bytes

18 CIS 191 - Lesson 2 Disk Partitions

19 CIS 191 - Lesson 2 Free Space Setting up Hard Drives Step 1 – Add hard drive to computer 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

20 CIS 191 - Lesson 2 Partition Boot Sector Data Master Boot Record (MBR) Free Space Setting up Hard Drives Step 2 - Partition the hard drive Partition Boot Sector Data 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.

21 CIS 191 - Lesson 2 Partition Boot Sector Data Master Boot Record (MBR) Free Space Setting up Hard Drives Step 2 - Partition the hard drive Partition Boot Sector Data Primary partition Primary partition The MBR partition table records the location, status and type of each primary partition. Each added partition has its own boot sector at the beginning.

22 CIS 191 - Lesson 2 Setting up Hard Drives Step 2 - Partition the hard drive Partition Boot Sector Data Master Boot Record (MBR) Partition Boot Sector Data Partition Boot Sector Data Partition Boot Sector Data Primary partition Primary partition Primary partition Primary partition The maximum number of primary partitions is four.

23 CIS 191 - Lesson 2 Partition Boot Sector Data Master Boot Record (MBR) Partition Boot Sector Data Partition Boot Sector Data Partition Boot Sector Data Primary partition Primary partition Primary partition Extended partition One of the four primary partitions can be an extended partition An extended may contain an arbitrary number of logical partitions Unused Boot Sector Data Unused Boot Sector Logical partition Logical partition Setting up Hard Drives Step 2 - Partition the hard drive

24 CIS 191 - Lesson 2 Partition Boot Sector Data Master Boot Record (MBR) Partition Boot Sector Data Partition Boot Sector Data Partition Boot Sector Data Unused Boot Sector Data Unused Boot Sector Setting up Hard Drives Step 3 – Add file systems to partitions Superblock Inode Table ext2 file system Data Blocks

25 CIS 191 - Lesson 2 fdisk and mount Show current partitions and their usage Partition Boot Sector /boot Master Boot Record (MBR) Partition Boot Sector / swap Partition Boot Sector /home Unused Boot Sector Free Space /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4 /dev/sda5

26 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.

27 CIS 191 – Lesson 2 [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): Specifying partitions Add 1 primary and 1 extended to new drive /dev/sda has been partitioned already. /dev/sdb has not been partitioned yet.

28 CIS 191 – Lesson 2 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 Unused Free /dev/sdb1 /dev/sdb5 Specifying partitions Add 1 primary and 1 extended to new drive 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.

29 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): Boot Sector /boot MBR Boot Sector / swap Boot Sector /home Unused Free Space Unused /dev/sda5 /dev/sda6 /dev/sda2 /dev/sda3 /dev/sda1 /dev/sda4

30 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 bsd disklabel 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): Boot Sector /boot MBR Boot Sector / swap Boot Sector /home Unused Free Space Unused /dev/sda5 /dev/sda6 /dev/sda2 /dev/sda3 /dev/sda1 /dev/sda4

31 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 Boot Sector /boot MBR Boot Sector / swap Boot Sector /home Unused Free Space Unused /dev/sda5 /dev/sda6 /dev/sda2 /dev/sda3 /dev/sda1 /dev/sda4 Use partprobe to update the kernel without rebooting. This is required if you want to mount a new partition.

32 CIS 191 - Lesson 2 fdisk Partition Utility – the l option [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 MBR Boot Sector / swap Boot Sector /home Unused Free Space Unused /dev/sda5 /dev/sda6 /dev/sda2 /dev/sda3 /dev/sda1 /dev/sda4

33 CIS 191 - Lesson 2 Making File Systems

34 CIS 191 - Lesson 2 [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................................ 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* dd command (continued) Reading and writing directly to a drive *Never do this to a drive containing important data

35 [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................ [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................ CIS 191 - Lesson 2 /dev/sdb6 is a newly added, un-mounted partition on /dev/sda /dev/zero has an unlimited numbers of binary zeros. Can be used to zero out a partition or drive.* dd command (continued) Reading and writing directly to a partition We can also write and read directly to the partition.* *Never do this to a partition containing important data

36 CIS 191 - Lesson 2 Adding File Systems 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. ext2 file system

37 CIS 191 - Lesson 2 Adding File Systems Superblock Inode Table mkfs –t ext2 /dev/sda6 Data Blocks Boot Sector /boot MBR Boot Sector / swap Boot Sector /home Unused Free Space Unused /dev/sda5 /dev/sda6 /dev/sda2 /dev/sda3 /dev/sda1 /dev/sda4

38 CIS 191 - Lesson 2 mkfs –t type device -t ext2 –t ext3 (has journaling) -t vfat (compatible with Windows) -t jfs (IBMs 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 6 th partition of 1 st 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 6 th partition of 1 st 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 mkfs command

39 [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]# CIS 191 - Lesson 2 This pen drive works with Windows or Linux File Systems FAT32 file system

40 CIS 191 - Lesson 2 Superblock Inode Table Data Blocks 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.

41 CIS 191 - Lesson 2 Superblock Inode Table ext2 file system Data Blocks [simmsben@opus ~]$ls -il letter 102609 -rw-r--r-- 1 simmsben cis90 1044 Jul 20 2001 letter 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 bigfile 102574 bin 102575 letter 102609 bigfile 102574 bin 102575 letter 102609 102609 - 1 simmsben cis90 1044 2001-07-20 2008-08-08 2008-06-20 Pointer(s) to data blocks inode number Type Number of links User Group Size Modification time Access Time Change time Pointer(s) to data blocks rw-rr-- Permissions

42 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: 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 ( ) Reserved blocks uid: 0 (user root) Reserved blocks gid: 0 (group root) First inode: 11 Inode size: 128 Journal UUID: 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.

43 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.

44 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. Dont delete it!

45 CIS 191 - Lesson 2 Mounting File Systems

46 CIS 191 - Lesson 2 Mounting and Un-mounting file systems mount [device-file] [directory] umount [device-file | directory] Mount information 1./etc/fstab (what to mount at boot time) 2./etc/mtab (current mount status) Mounting File Systems

47 CIS 191 - Lesson 2 / /bin /etc /mnt /cdrom On the rh9 VM [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 / ext3 rw 0 0 none /proc proc rw 0 0 /dev/sda1 /boot ext2 rw 0 0 none /dev/pts devpts rw,gid=5,mode=620 0 0 /dev/sda5 /home ext3 rw 0 0 none /dev/shm tmpfs rw 0 0 [root@rh9 root]# [root@rh9 root]# ls -F /home /boot /mnt /boot: boot.b kernel.h module-info-2.4.20-6 vmlinuz@ chain.b lost+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]# /dev /boot /home /rsimms /grub /lost+found /dev/sda1 /dev/sda2 /dev/sda5 /dev/sda6 /floppy /hgfs mount command with no arguments shows current mount status in /etc/mtab Showing current mount status

48 CIS 191 - Lesson 2 / /bin /etc /mnt /dir1 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]# /dev /boot /home /rsimms /grub /lost+found /fdir2 /lost+found /dev/sda1 /dev/sda2 /dev/sda5 /dev/sda6 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 Making a file system and mounting it

49 /dir1 /fdir2 /lost+found / /bin/etc/mnt /cdrom /dev/boot/home /rsimms /grub /lost+found /floppy /hgfs /lib /dev/sda6 /dev/sda1 /dev/sda5 Mounting File Systems Like pinning the tail on the donkey mount /dev/sda6 /mnt

50 / /bin/etc/mnt /dir1 /dev/boot/home /rsimms /grub /lost+found /dir2 /lost+found /lib /dev/sda1 /dev/sda5 Mounting File Systems Like pinning the tail on the donkey /dev/sda6 mount /dev/sda6 /mnt

51 Mounting File Systems Caveats Dont mount a file system to a directory you are in. You cant un-mount a file system you have cded into: [root@rh9 mnt]# umount /mnt umount: /mnt: device is busy [root@rh9 mnt]# cd [root@rh9 root]# umount /mnt [root@rh9 root]#

52 CIS 191 - Lesson 2 [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 / ext3 rw 0 0 none /proc proc rw 0 0 /dev/sda1 /boot ext2 rw 0 0 none /dev/pts devpts rw,gid=5,mode=620 0 0 /dev/sda5 /home ext3 rw 0 0 none /dev/shm tmpfs rw 0 0 [root@rh9 root]# device mount point file system type mount options dump frequency fsck pass Note: spaces added to output above for readability Mounting File Systems mount command and /etc/mtab

53 CIS 191 - Lesson 2 [root@rh9 root]# cat /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext2 defaults 1 2 none /dev/pts devpts gid=5,mode=620 0 0 LABEL=/home /home ext3 defaults 1 2 none /proc proc defaults 0 0 none /dev/shm tmpfs defaults 0 0 /dev/sda3 swap swap defaults 0 0 /dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0 device mount point file system type mount options dump frequency fsck pass Note: spacing modified in output above for readability Mounting File Systems /etc/fstab /etc/fstab is used to automatically mount file systems at boot time

54 CIS 191 - Lesson 2 [root@rh9 root]# cat /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext2 defaults 1 2 none /dev/pts devpts gid=5,mode=620 0 0 LABEL=/home /home ext3 defaults 1 2 none /proc proc defaults 0 0 none /dev/shm tmpfs defaults 0 0 /dev/sda3 swap swap defaults 0 0 /dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0 /dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0 device mount point file system type mount options dump frequency fsck pass Note: spacing modified in output above for readability Swap Space /etc/fstab /etc/fstab is used to automatically mount file systems at boot time


Download ppt "CIS 191 - Lesson 2 Storage Devices. CIS 191 - Lesson 2 Floppy drive and diskettes Hard drive (IDE and SCSI) USB flash drive (aka pen drive) Storage Devices."

Similar presentations


Ads by Google