Sei sulla pagina 1di 18

LINUX

File system Hierarchy Standards

28-Apr-14

Presenters Name

Agenda

What is FHS? Partitions File system & integrity Control access Symbolic link Root file system init levels shutdown

28-Apr-14

Presentation Name

Disk Drives Under Linux

Integrated Device Electronics (IDE)


/dev/hda Primary master IDE /dev/hdb Primary slave IDE /dev/hdc Secondary master IDE (CD-ROM) /dev/hdd Secondary slave IDE Only two disk drives for single IDE( total four)

Small Computer System Interface (SCSIscuzzy)



28-Apr-14

/dev/sda First SCSI drive /dev/sdb Second SCSI drive /dev/sdc Third SCSI drive Up to 15 devices on a single bus

Presentation Name

Disk Partitions
Primary partitions
/dev/hda1 /dev/hda4 One of these is active Contains logical partitions Only one exists on a single physical disk

Extended partitions

Logical partitions

1 to 12 partitions may be created Numbered from 5 to 16


/dev/hda1(primary) /dev/hda2(primary) /dev/hda3(extended) /dev/hda5(logical) /dev/hda6(logical)

Typical Example

28-Apr-14

Presentation Name

Managing partitions
fdisk
fdisk [device] Try for man fdisk Try for /sbin/fdisk l /dev/hda

Mkfs
mkfs [-t fs_type] [fs_options] device Try for man mkfs Options for fs_type are ext2, msdos For fs_options c(check),-v ..

Mkswap
Mkswap device Try for man mkswap mkswap /dev/hda5

28-Apr-14

Presentation Name

Maintain the Integrity


df
df [options] [directories] df h df i df . du du du du [options] [directories] s /home/user Ss /home/user -csh /home/*

du

fsck
fsck [options] [-t type] [fs-options] filesystems fsck /dev/hda1 fsck fv /dev/hda5

28-Apr-14

Presentation Name

Control File system


mount
Mount t msdos /dev/fd0 /floppy

umount umount [options] [device/directory] /etc/fstab


Device - /dev/hda1 Mount point - /, /home File system type
ext2,ext3,msdos,vfat,iso9660,nfs,swap,proc

Mount options
auto, defaults, user .

Dump frequency
1 for linux types 0 for others

Pass number for fsck


0,1,2 /(root mount) contains 1
28-Apr-14

Presentation Name

Set and view disk quotas


Per user hard limit Per-user soft limit Per-group hard limit Per-group soft limit Grace period quota u [options] user quota g [options] group quotaon [options] [filesystems] quotaoff [options] [filesystems] edquota -u user

28-Apr-14

Presentation Name

Control Access to Files


User the user that owns the file Group the group that owns the file Other all other users on the system Octal representation rwxrwxrwx ---/---/--umask (usually 022) Chmod u+x, go-w, o+t, a=rw stat filename Form Symbolic Binary Octal
28-Apr-14

For Files rw-rw-rw110110110 6 6 6

For Directories rwxrwxrwx 111111111 7 7 7

Presentation Name

Symbolic modes
For chmod command Category User class Mode Description u g o a User Group Other All classes

operation

+ =

Take away permissions


Add permissions Set permission exactly Read permission Write permission Execute permission Execute permission for directories and files with another execute permission, but not plain files

permission r w x X
28-Apr-14

Presentation Name

Setting up a Workgroup


28-Apr-14

Existing 3 or more users (project1..3) groupadd du2 usermod G du2 project1 (project2, project3) mkdir /home/du2 chgrp du2 /home/du2 chmod 770 /home/du2 chmod g+s,o+t /home/du2 su project1 cd /home/du2 touch file1 ls l file1 exit; su project2 cd /home/du2 rm file1

Presentation Name

Manage File Ownership


chown
chown [options] user-owner files chown v project2 file1

chgrp
Chgrp [options] group-owner files

28-Apr-14

Presentation Name

Create and Manage links


ln [options] file link ln [options] files directory Diff between hardlink & symbolic link find / -lname file1 which, locate updatedb, whatis, apropos

28-Apr-14

Presentation Name

The root File system


/bin executable system commands /dev-device files,necessary to accessing disks,devices /etc configuration info unique to system at boot /lib shared libraries,kernel modules for initialization /mnt empty, used for temporary partitions /root - typical home directory for super user /sbin utilities for system administration /boot files for LILO /home files for system users /opt user for installation files of third party /tmp for temporary files, deleted upon every boot /usr hierarchy of executable programs, sharable read only files /var contains logs, mail and spool
28-Apr-14

Presentation Name

Boot and Runlevels


See lilo.conf file See /etc/inittab 0 halt the system 1,s,S single user mode 2 multiuser mode with no NFS file sharing 3 full multiuser mode 4 Typically un used 5 Full multiuser mode with GUI 6 equal to 0(reboot) Try for init 1 Try for init 3

28-Apr-14

Presentation Name

Shutdown
shutdown [options] time [warning message] shutdown r now shutdown r +5 System maintenance is required shutdown h 2:30 shutdown h now

28-Apr-14

Presentation Name

Summary
Partitions fdisk File systems mkfs Integrity df, du, fsck Control access chmod Links ln Locating locate, which, whatis Root file system initlevels - init

28-Apr-14

Presentation Name

FHS

28-Apr-14

Presentation Name

Potrebbero piacerti anche