23
Chapter 8: Adding a Disk Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Embed Size (px)

Citation preview

Page 1: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Chapter 8: Adding a Disk—

Unix Hard Disk Basics

Installation and Configuration

Barry Kane CMSC-691X

Page 2: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Basic Steps

• Choose Disk

• Install Hardware

• Create Device Files

• Partition

• Format file system

• Configure, Label, & Mount

Page 3: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Choose Disk

• SCSI

• IDE (ATA)

• Fibre Channel

• USB

• FireWire (IEEE 1394 or iLink)

Page 4: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

SCSI

• Small Computer System Interface

• 5, 10, 20, 40, 80 or 160 MB/sec.

• 7 to 15 devices per bus

• Good at arbitrating multiple bus requests

Page 5: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

The Evolution of SCSIVersion Freq. Width Speed Len Diff. Len

SCSI-1 5 MHz 8 bits 5 MB/s 6m 25m

SCSI-2 5 MHz 8 bits 5 MB/s 6m 25m

Fast SCSI-2 10 MHz 8 bits 10 MB/s 3m 25m

F/W SCSI-2 10 MHz 16 bits 20 MB/s 3m 25m

Ultra SCSI 20 MHz 8 bits 20 MB/s 1.5 25m

W-U SCSI 20 MHz 16 bits 40 MB/s 1.5 25m

W-U2 SCSI 40 MHz 16 bits 80 MB/s — 25m (HVD)

12m (LVD)

W-U3 SCSI 80 MHz 16 bits 160 MB/s — 12m (LVD)

Page 6: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

IDE

• Integrated Drive Electronics

• Inexpensive

• competes for bus access (only one at a time)

• max 2 devices/bus

• Dependent on BIOS– First 1024 cylinders for boot access

Page 7: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Connect the Disk

• IDE- choose master or slave, and IDE bus number

• SCSI - make sure cables are properly terminated. Pick device number.

Page 8: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Low Level Format

• Make sure device entry exists (/dev/xxxx)

• Format the disk using manufactures programs -- most disks come preformated

Page 9: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Partition

• fdisk, pdisk, cdisk• File systems and swap

– ext2– Fat32– Unix– Swap– HFS– Others....

Page 10: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Create File System

• Unix, Swap, or other file systems

• mkfs or newfs

• Check the file system - fsck– Also used to repair a fs with the -r option– Can walk through the fstab file and check

partitions in the order specified by the Pass parameter

Page 11: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Label and Mount

• mount & umount– mount -t iso9660 /dev/cdrom /mnt/cdrom– umount /mnt/cdrom– mount -a

Page 12: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Label and Mount

• /etc/fstab file– Device file or virtual file system– Mount point– File system type– Options– Dump– Pass#

Page 13: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

fstab file example# Device Mountpoint FStype Options Dump Pass#

/dev/wd0s1b none swap sw 0 0

/dev/wd0s1a / ufs rw 1 1

/dev/wd0s1f /usr ufs rw 2 2

/dev/acd0c /cdrom cd9660 ro, noauto 0 0

proc /proc procfs rw 0 0

server:/export /server nfs rw 0 0

Page 14: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat Linux

• Install new disk– IDE

• make sure bios can recognize

– SCSI• scan SCSI bus for ID conflict

• SCSI bios can low level format

• if no interface boot to see if you must install a SCSI driver before the kernel can recognize the disk

Page 15: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

• Ignore initial warnings about the partition table — partitioning after system booted

• First check to see if device files exist– form /dev/sdXN– first on chain, first partition /dev/sda1

• If no device file then make them– /dev/MAKEDEV script

• e.g., # cd /dev # ./MAKEDEV sda

Page 16: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

• Ready for partitioning — fdisk– many variations — read man page for system

• Good to make first partition small to ensure for old BIOS and other operating systems

• Warning if greater than 1024 cylinders– for runtime software (e.g., LILO)– other OS boot & partition software

• e.g., DOS FDISK, OS/2 FDISK

Page 17: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

• fdisk program– interactive — press m for command list– command list

• n to create a new partition• t to change the partition type• p to print the partition table• w to write the partition table to disk

Page 18: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

– nothing changed on disk until you tell fdisk to write the partition table

• room for four “primary” partitions but can”extend” by pointing to another table with four more

Command (m for help): new

e extended

p primary partition (1-4): p

Partition number (1-4): 2

First cylinder (256-5721, default 256): 256

Last cylinder or +size or +sizeM or +sizeK (256-1275, default 1275): 511

Page 19: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont• 2nd partition — create a swap partition

– change type to LINUX SWAP

• 3rd partition — remainder of disk

Command (m for help): type

Partition number (1-4): 2

Hex code (type L to list codes): 82

Changed system type of partition 2 to 82 (Linux swap)

Page 20: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

• Review Command (m for help) print

Command (m for help) printDisk /dev/sda: 255 heads, 63 sectors, 5721 cylindersUnits = cylinders of 16065 * 512 bytes Device Boot Start End Blocks Id System/dev/sda1 1 255 2048256 83 Linux/dev/sda2 256 511 2056320 82 Swap/dev/sda3 512 5721 41849325 83 Linux

Page 21: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

• If satisfied write the table to diskCommand (m for help) write

Command (m for help) writeThe partition table has been altered!Calling ioctl( ) to re-read partition table.SCSI device sda: hdwr sector=512 bytes. Sectors=91923356 [44884] [44.9GB]sda: sda1 sda2 sda3Syncing disks.

Page 22: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

• Make a file system on your new partitions– mk2fs /dev/sda1– mkswap -c /dev/sda2

• Check the new file system– fsck -f /dev/sda1

Page 23: Chapter 8: Adding a Disk — Unix Hard Disk Basics Installation and Configuration Barry Kane CMSC-691X

Adding a Disk to Red Hat — cont

• Mount the partition– mount /dev/sda1 /tmp

• Enable swap– swapon /dev/sda2

• Check your workdf /tmpFilesystem 1k-blocks Used Available Use% Mounted on/dev/hdb1 2071384 349816 1616344 18% /

• Edit the fstab file to save your work for next time