Anda di halaman 1dari 3

CS3100

OperatingSystems

Spring2002

LinuxFileSystems
I.

Devices
A. devicefiles
i. alldevicesaretreatedasfiles
ii. the/devdirectoryrepresentsavailabledevices
iii. devicenamesaresemidescriptive
B. blockandchar(orraw)devices
i. blockdevicesuseabuffersystem
ii. manydeviceshavebothablockandcharfileentry
C. majorandminornumbers
i. themajornumberrepresentsadevicedriver,theminornumberisaparameter
ii. eachdevicedrivermayhandleafamilyofdevices

II.

Partitions
A. apartitionisaphysicallydefinedareaofdisk
B. advantages
i. preventspotentialencroachment,limitsgrowth
ii. isolatescorruption
iii. maylimitfragmentation
iv. facilitatesbackupandrecovery
v. allowsseparatebooting(separateOSsystems)

III.

FileSystems
A. everypartitioncontainsonefilesystem
B. sometypes
i. s5
anolderSystemVUnixstandardwithfilenameslimitedto14chars
ii. ufs
currentSystemVstandard:multiplesuperblocks,255charfilenames,var
logicalblocksizes
iii. ext2
similartoufs,theLinuxstandard
iv. iso9660 CDROMstandardwithDOS8+3filenames
v. hsfs
iso9660withextendedfilenames
vi. msdos Windowsstandard
vii. swap
usedexclusivelyforswapspacebytheOS
viii. highsierra
CommonCDROMstandardwithextendedfilenames
ix. ntfs
WindowsNTstandard
x. tar
Unixsequentialmediastandard
xi. fat32
Windowsstandard

IV.

Theext2filesystem(logicalblocksare1kbytes)
A. bootblock
B. superblock

containsthebootstrapprogramandthepartitioninformationtabledisk
partitionsize,diskparameters,superblocksize,etc.
containsthefilesystemtype,alistoffreeinodes(partial),andalistorbitmap
(FAT)offreedatablocks(partial)
asequenceof128byteentriesoneentryforeveryfileinthesystem

C. inodeblocks
i. filetype
ii. numberoflinks
iii. UIDoftheowner
iv. GUIDoftheownersgroup
v. filemode(permissions)

329110131.doc

09/09/16

CS3100

OperatingSystems

Spring2002

vi.
vii.
viii.
ix.
x.

filesize(inbytes)
lastmodificationtimestamp
lastaccesstimestamp
lastinodeupdatetimestamp
15datablockpointers
1. 112pointerstothefirst12datablocks
2. 13apointertoasingleindirectdatablock
3. 14apointertoadoubleindirectdatablock
4. 15apointertoatripleindirectdatablock
Thefirstinodeisassociatedwiththerootdirectoryfile.Theinodeblockscanbeorganizedinto
alinkedlistwithNinodespernode.So,onlythefirstNinodesmightresideimmediatelyfollowing
thesuperblock.(Nistypicallyalargenumber.)
D. datablocks

V.

datablocksforfiles

Directories
A. adirectoryisafilecontainingalistof2valueentriesforeachmemberfile
i. thetextualfilename
ii. theinodenumber
B. Linuxmaintainstheinodenumberofthedefaultorworkingdirectory
C. Example:%lsl

VI.

StandardpartitionsforaLinuxharddisk
A. rootdefaultfilesystemext2
B. swapfilesystemisswap
C. usercreatedanddefined

VII.

AdministrationofFileSystems
A.
B.
C.
D.
E.
F.
G.
H.

fdisk
mkfs
mount
umount
fsck
sync
du
df

createpartitions
createafilesystemonapartition
attachafilesystemundertheLinuxrootdirectorytoallowaccess
deattachafilesystemfromtheLinuxrootdirectory
checkaLinuxfilesystemforintegrity
synchronizethememoryimageofafilesystemwiththephysicalimage
displaydiskspaceusageinformationbydirectory
displayfilesystemspaceusageinformation

VIII. Examplecreatingapartitionfora/databasefilesystemanddirectory
A. %fdisk
Disk/dev/hda:255heads,63sectors,784cylilnders
Units=cylindersof16065*512bytes
Device
Boot Start
End
Blocks
/dev/hda1 *
1
220
175432
/dev/hda2
221
473
209847
/dev/hda4
635
784
132345
/dev/hda5
1
5
40099
/dev/hda6
6
219
176543

ID
5
6
81
82
83

FileSystem
extended
msdos
Linuxnative
swap
Linuxnative

command(mforhelp):m
availablecommands

329110131.doc

09/09/16

CS3100

OperatingSystems

Spring2002

a
toggleabootableflag
d
deleteapartition
l
listknowpartitiontypes
m
printthishelpmenu
n
addanewpartition
p
printthepartitiontable
q
quitwithoutsavingchanges
w
savenewpartitiontabletodiskandexit
command(mforhelp):n
option:
l
logical(numbersover5)
p
primary(numbers14):
p
partitionnumber(14):3
firstcylinder(default474):474
lastcylinder(default634): 634
command(mforhelp):p
Device
Boot Start
End
Blocks
ID FileSystem
/dev/hda1 *
1
220
175432 5
extended
/dev/hda2
221
473
209847 6
msdos
/dev/hda3
474
634
273645 83 Linuxnative
/dev/hda4
635
784
132345 83 Linuxnative
/dev/hda5
1
5
40099
82 swap
/dev/hda6
6
219
176543 83 Linuxnative
command(mforhelp):w
B. %mkfstext2/dev/hda3
mke2fs1.14,9Jan1999forEXT2filesystem
...
superblockbackupsstoredonblocks:8193,23412,67462,12343
writinginodetables:done
writingsuperblocksandfilesysteminformation:done
C. %mounttext2/dev/hda3/database
variations:%mounta
%mount/dev/floppy
options:(o)

rw
ro
auto
user
noauto
defaults

mountinginformationinfile/etc/fstab
filesystemtypeisin/etc/fstab

read/write
readonly
determinethefilesystemtypefromthesuperblock
allowausertomount
donotautomaticallymount(mustbemountedexplicitly)
applysystemdefaults

example/etc/fstab
#mountdevice
/dev/hda5
/dev/hda6
/dev/fd0
/dev/hda3

329110131.doc

mountpoint
swap
/
/floppy
/database

filesystemtype
swap
ext2
auto
ext2

options
defaults
defaults
noauto,user
defaults

09/09/16

Anda mungkin juga menyukai