ITI481: Unix Administration - PowerPoint PPT Presentation

About This Presentation
Title:

ITI481: Unix Administration

Description:

A typical Linux installation will divide one or more hard drives into ... a toggle a bootable flag. b edit bsd disklabel. c toggle the dos compatibility flag ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 19
Provided by: kkap
Category:

less

Transcript and Presenter's Notes

Title: ITI481: Unix Administration


1
ITI-481 Unix Administration
  • Meeting 4

2
Todays Agenda
  • Disk Partitioning
  • Directories and File Systems
  • Mounting Local File systems
  • Network File System (NFS)

3
Disk Partitions.
  • A typical Linux installation will divide one or
    more hard drives into multiple partitions.
  • Each disk is given its own device name/dev/hdX
    (X can range from a-z) IDE disks/dev/sdX (X
    can range from a-z) SCSI disks
  • A partition number is added to the device
    name/dev/hdXY (Y is the partition number) IDE
    disks/dev/sdXY (Y is the partition number)
    SCSI disks For example, the first partition on
    the first IDE drive on a system would be
    /dev/hda1.
  • Disk partition information can be viewed using
    the df command.

4
Creating a New Partition
  • During the Red Hat installation, you are prompted
    to partition your hard drive using Druid Disk.
  • After installation, can modify existing
    partitions using fdisk
  • Need to identify partition as primary (only up to
    4) or extended.
  • Need to identify file system type usually Linux
    or Linux swap.
  • Can create ext2 file systems with mke2fs and can
    create swap file systems with mkswap.
  • Always backup your data before modifying the
    partition table!!!

5
fdisk
  • /sbin/fdisk /dev/hda
  • 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)

6
Exercise Creating a New Partition
  • Launch fdisk edit hard disk /dev/hdagt
    /sbin/fdisk /dev/hda
  • You are now working within the fdisk application.
    Type the followingp ltentergt (to view the
    current partition table)n ltentergt (to add a new
    partition)l ltentergt (for a logical
    partitionltentergt (accept the default first
    cylinder)100M ltentergt (100MB partition)p
    ltentergt (verify that partition /dev/hda10 has
    been addedgtw ltentergt (write table to disk and
    exit)
  • If you get an error when attempting to write out
    the partition table to the disk, you may need to
    reboot.
  • Create a Linux ext2 file system on the new
    partitiongt /sbin/mke2fs /dev/hda10

7
File Systems
  • Key partitions are mounted as file systems at
    boot time through rc scripts.
  • File systems overlay directories (i.e /boot is
    mounted on /dev/hda1).
  • Can use df to view currently mounted file systems.

8
Some Common File System Types
  • Type
  • ext2
  • swap
  • NFS
  • msdos
  • vfat
  • iso9660
  • proc
  • File System
  • linux extended
  • linux swap
  • network file system
  • DOS-FAT
  • VFAT
  • ISO 9660
  • /proc

9
Typical Directory Structure
  • / - begins the file system structure (root)
  • /boot - kernel files
  • /usr scripts and binary applications
  • /sbin basic system tools
  • /home user home directories
  • /var log files and other time sensitive data
  • /etc configuration files
  • /dev device drivers
  • /opt typical install location for some
    commercial software
  • /tmp temporary storage
  • /mnt mount points for floppy disks and CD-ROMS
  • swap swap space

10
Sample Directory Tree with Mount Points
11
Mounting and Unmounting File Systems
  • File Systems mounted with the mount
    commandmount options device directoryFor
    examplemount o rw t ext2 /dev/hda10 /tmp
  • File systems umounted with the umount
    commandumount -f directory For
    exampleumount /tmp
  • File systems should only be umounted when they
    are not in use.

12
/etc/fstab
  • Configuration file for all partitions known to
    the system.
  • Entry format/dev/device /dir/to/mount fstype
    parameters fs_freq fs_passnoSample
    entry/dev/hda10 /tmp ext2 defaults 1 2
  • For entries in /etc/fstab, can run mount command
    with just mount pointgt mount /tmpTo mount all
    file systemsgt mount -a

13
Network File System (NFS)
  • NFS allows access to file systems on remote file
    servers.
  • Remote file systems can be mounted to provide
    services comparable to local file systems.
  • Uses TCP/IP.
  • Uses client/server model.
  • There are some security risks associated with
    NFS.

14
NFS Server
  • Started though rc script/etc/rc.d/init.d/nfsMus
    t be started after/etc/rc.d/init.d/portmap
  • Uses these RPC daemons in /usr/sbin
  • rpc.nfsd main component of NFS system
  • rcp.mountd handles mount requests
  • rpc.quotad allows for quota enforcement via
    NFS.
  • /etc/exports configuration file
  • Above utilities are part of knfsd package.

15
/etc/exports
  • Contains information about partitions that are
    sharable and hosts they can be shared with.
  • Entry format/dir/to/export client1(permissions)
    client2 (permissions)Sample entry/tmp
    trainee101.rutgers.edu (rw,no_root_squash)
  • Need to run exportfs to inform NFS server process
    about changes in /etc/exportsgt
    /usr/sbin/exportfs a (exports all entries)

16
NFS Clients
  • Requires knfsd-clients package.
  • Necessary services started from/etc/rc.d/init.d/
    nfslock
  • RPC daemons in /sbin handle file locking between
    client and server
  • rpc.locked
  • rpc.statd
  • Remote file systems usually mounted at boot time
    through /etc/rc.d/init.d/netfs that reads entries
    for remote mounts from /etc/fstab.

17
Mounting Remote File Systems from the Client
  • Mount command is used to mount remote file
    systemsgt mount trainee101.rutgers.edu/tmp /foo
  • Frequently used mounts can be added to
    /etc/fstabtrainee101.rutgers.edu/tmp /foo nfs
    rw,bg 0 0

18
Homework
  • Read chapters 11 and 19 and in Linux
    Administration A Beginners Guide.
Write a Comment
User Comments (0)
About PowerShow.com