SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
Chapter 10Chapter 10
File SystemFile System
Ref. Pge. 126
Block DeviceBlock Device
●
Block DeviceBlock Device
– Allows random accessAllows random access
– Divided into blocksDivided into blocks
●
Typical Block DeviceTypical Block Device
– Hard DiskHard Disk
– Floppy DiskFloppy Disk
– Optical DiskOptical Disk
– Virtual Block DeviceVirtual Block Device
Hard DiskHard Disk
●
Naming ConventionNaming Convention
– IDE:IDE: hda, hdb, …hda, hdb, …
– SCSI/SATA:SCSI/SATA: sda, sdb, ...sda, sdb, ...
master slave
1st Channel hda hdb
2nd Channel hdc hdd
Ref. Pge. 127
Hard Disk PartitionHard Disk Partition
●
Partitioning rules:Partitioning rules:
– Divided by cylinderDivided by cylinder
– Maximum of four Primary PartitionsMaximum of four Primary Partitions
– Only one of primary partitions may beOnly one of primary partitions may be
used as an Extended Partitionused as an Extended Partition
– An extended partition contains numbersAn extended partition contains numbers
of Logical Partitionof Logical Partition
– Only primary and logical partitions can beOnly primary and logical partitions can be
populated with file systemspopulated with file systems
Ref. Pge. 130
Partition Numbering RulesPartition Numbering Rules
●
Primary / Extended Partition:Primary / Extended Partition:
– 1 ~ 41 ~ 4
●
Logical Partition:Logical Partition:
– 5 up5 up
Ref. Pge. 132
Partitioning ToolPartitioning Tool
●
fdisk <disk>fdisk <disk>
– Performs disk partitioningPerforms disk partitioning
– Common options:Common options:
●
­l­l : view partition information: view partition information
Ref. Pge. 139
UsingUsing fdiskfdisk
●
InternalInternal fdiskfdisk commandscommands
– mm : help: help
– pp : prints partition table: prints partition table
– nn : creates new partition: creates new partition
– ll : lists partition type ID: lists partition type ID
– tt : changes partition type ID: changes partition type ID
– dd : deletes partition: deletes partition
– ww : save and exit: save and exit
– qq : quit without saving: quit without saving
Loop DeviceLoop Device
●
Access a file as a block deviceAccess a file as a block device
# dd if=/dev/zero of=mydisk bs=1M count=32# dd if=/dev/zero of=mydisk bs=1M count=32
File SystemFile System
●
Linux supports many types of fileLinux supports many types of file
system:system:
– Ext2, Ext3, Ext4Ext2, Ext3, Ext4
– ReiserfsReiserfs
– JFSJFS
– XFSXFS
– FAT, NTFSFAT, NTFS
– ISO9660ISO9660
– ......
Ref. Pge. 142
Ext2 File SystemExt2 File System
●
Partition divided into blocks withPartition divided into blocks with
fixed block size (1k, 2k, 4k)fixed block size (1k, 2k, 4k)
●
Block usages:Block usages:
– SuperblockSuperblock
– Inode BlocksInode Blocks
– Data BlocksData Blocks
Super BlockSuper Block
●
The first block of a file systemThe first block of a file system
●
May have a couple of copiesMay have a couple of copies
●
Contains general information:Contains general information:
– Block SizeBlock Size
– Pointers to free inodesPointers to free inodes
– Pointers to free blocksPointers to free blocks
– Pointer to root directoryPointer to root directory
– Mounting timeMounting time
– ......
Inode (Index Node)Inode (Index Node)
●
128 bytes for each128 bytes for each
●
Contains file information:Contains file information:
– OwnershipOwnership
– PermissionPermission
– File TypeFile Type
– Time StampsTime Stamps
– Pointers to blocksPointers to blocks
Data BlockData Block
●
Regular File:Regular File:
– The actual dataThe actual data
●
Directory:Directory:
– File NameFile Name
– Inode NumberInode Number
File SeekingFile Seeking
Superblock
Inode
Table
●
For a path:For a path:
– /d1/f1/d1/f1
d1: 1234
d2: 2345
d3: 3456
f1: 4567
f2: 5678
f3: 6789
xxx
xxxx
xxx
...
...
Block:
3654
...
...
Block:
9753
...
d1 f1/
Inode
1234
Inode
4567
Data
Block
File System FeaturesFile System Features
●
Journaling:Journaling:
– Keeps a journal of file operationKeeps a journal of file operation
– Makes recovery much fasterMakes recovery much faster
●
ACL:ACL:
– More flexible control above traditionalMore flexible control above traditional
permission schemepermission scheme
●
Label:Label:
– Allows to use label name and regardlessAllows to use label name and regardless
changing of device namechanging of device name
Creating File SystemCreating File System
●
mkfs partitionmkfs partition
– Makes file system on partitionMakes file system on partition
– Common options:Common options:
●
­t ­t : file system type: file system type
●
­b ­b : block size: block size
●
­i ­i : inode ratio to block: inode ratio to block
●
­j ­j : turn on journal: turn on journal
●
­c ­c : check bad blocks: check bad blocks
Ref. Pge. 145
Mounting File SystemMounting File System
●
mount device /mount/pointmount device /mount/point
– The device must be formatedThe device must be formated
– The mount point must be an empty directoryThe mount point must be an empty directory
– Displays current mounting file systems if noDisplays current mounting file systems if no
argument givenargument given
– Common options:Common options:
●
­t ­t : file system type: file system type
●
­­bind ­­bind : mounts directory instead of device: mounts directory instead of device
●
­o m_opts ­o m_opts : mount options: mount options
Ref. Pge. 160
Common Mount OptionsCommon Mount Options
●
ro/rw : read and ro/rw : read and writewrite
●
sync/async : sync/async : synchronizationsynchronization
●
atime/noatim : atime/noatim : access time updatingaccess time updating
●
dev/nodev : dev/nodev : device accessdevice access
●
exec/noexec : exec/noexec : program runningprogram running
●
suid/nosuid : suid/nosuid : suid/sgid functionsuid/sgid function
●
remount,m_opt : remount,m_opt : changes mount options on achanges mount options on a
mounted file systemmounted file system
TheThe /etc/fstab/etc/fstab
●
Mount files systems on startupMount files systems on startup
●
While runningWhile running mount ­amount ­a
●
Fields:Fields:
– Device Name/ID (shown by runningDevice Name/ID (shown by running blkidblkid))
– Mount pointMount point
– File system typeFile system type
– Mount optionsMount options
– dumpdump settings (0 for off and 1 for on)settings (0 for off and 1 for on)
– fsckfsck settings (1 for root and 2 for others, 0 for off)settings (1 for root and 2 for others, 0 for off)
Ref. Pge. 164
Example ofExample of /etc/fstab/etc/fstab
proc /proc proc nodev,noexec,nosuid 0 0proc /proc proc nodev,noexec,nosuid 0 0
/dev/mapper/system­root / ext4 errors=remount­ro 0 1/dev/mapper/system­root / ext4 errors=remount­ro 0 1
LABEL=/boot /boot ext2 defaults 0 2LABEL=/boot /boot ext2 defaults 0 2
/dev/mapper/system­home /home reiserfs defaults 0 2/dev/mapper/system­home /home reiserfs defaults 0 2
/dev/mapper/system­swap none swap sw 0 0/dev/mapper/system­swap none swap sw 0 0
Unmounting File SystemUnmounting File System
●
umount <device|/mount/point>umount <device|/mount/point>
– Device must be unmounted before detachingDevice must be unmounted before detaching
– Device is not being used (check withDevice is not being used (check with fuserfuser):):
●
Opening filesOpening files
●
Running programRunning program
●
Working directoryWorking directory
Ref. Pge. 163
Swap SpaceSwap Space
●
Frees out real memory by swapping outFrees out real memory by swapping out
unused pages to diskunused pages to disk
●
Swap pages in when reuseSwap pages in when reuse
●
Impacting performance by high swappingImpacting performance by high swapping
●
Partition ID is 82Partition ID is 82
Ref. Pge. 147
Swap CommandsSwap Commands
●
mkswap <partition>mkswap <partition>
– Formats partition as swap spaceFormats partition as swap space
●
swapon <partition>swapon <partition>
– Turns on swap spaceTurns on swap space
●
swapoff <partition>swapoff <partition>
– Turns off swap spaceTurns off swap space
●
freefree
– Displays memory usagesDisplays memory usages
Checking FilesystemChecking Filesystem
●
fsck <device>fsck <device>
– Examines file system and fixes errorsExamines file system and fixes errors
– Common optionsCommon options
●
­A ­A : checks all file system: checks all file system
●
­N ­N : test only: test only
●
­y ­y : always answer YES: always answer YES
Monitor File System UseMonitor File System Use
●
dfdf
– Displays summary of disk spaceDisplays summary of disk space
– Common optionsCommon options
●
­h ­h : human readable format: human readable format
●
dudu
– Displays directory consummation on diskDisplays directory consummation on disk
– Common optionsCommon options
●
­h ­h : human readable format: human readable format
●
­s ­s : summary of directories only: summary of directories only
Ref. Pge. 155/156
Quota ConceptQuota Concept
●
Limitation of data consumption for aLimitation of data consumption for a
user/group in a file systemuser/group in a file system
●
Based on block or inode usageBased on block or inode usage
●
Two types of limit:Two types of limit:
– Soft Limit: warning onlySoft Limit: warning only
– Hard Limit: errorHard Limit: error
– Grace Period: how long the soft limit may beGrace Period: how long the soft limit may be
exceeded, rechargeableexceeded, rechargeable
Ref. Pge. 205
Quota ImplementationQuota Implementation
●
Modify the option field ofModify the option field of /etc/fstab/etc/fstab
# defaults# defaults,usrquota,grpquota,usrquota,grpquota
●
Create record files:Create record files:
# touch /mount/point/aquota.{user,group}# touch /mount/point/aquota.{user,group}
●
Remount file systemRemount file system
# mount ­o remount /mount/point# mount ­o remount /mount/point
●
Calculate current useCalculate current use
# quotacheck /mount/point# quotacheck /mount/point
●
Turn on quotaTurn on quota
# quotaon /mount/point# quotaon /mount/point
Quota ConfigurationQuota Configuration
●
edquota ­u <user>edquota ­u <user>
Filesystem blocks soft hard inodes soft hardFilesystem blocks soft hard inodes soft hard
devicedevice 10600  20000 25000   207 0  010600  20000 25000   207 0  0
●
edquota ­g <group>edquota ­g <group>
– Edits group quotaEdits group quota
●
edquota ­tedquota ­t
– Edits grace timeEdits grace time
●
edquota ­p user1 ­u user2 edquota ­p user1 ­u user2 
– Copies quota settingsCopies quota settings
Quota InformationQuota Information
●
quotaquota
– Reports quota usageReports quota usage
– A regular user can only views her/his own quotaA regular user can only views her/his own quota
●
repquota <device>repquota <device>
– Root onlyRoot only
– Reports quotas for all users and groupsReports quotas for all users and groups
– Common optionsCommon options
●
-u : displays user quota report-u : displays user quota report
●
-g : displays group quota report-g : displays group quota report
●
-a : all devices if no device specified-a : all devices if no device specified

Weitere ähnliche Inhalte

Was ist angesagt?

Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
Pegah Taheri
 
LizardFS-WhitePaper-Eng-v3.9.2-web
LizardFS-WhitePaper-Eng-v3.9.2-webLizardFS-WhitePaper-Eng-v3.9.2-web
LizardFS-WhitePaper-Eng-v3.9.2-web
Szymon Haly
 

Was ist angesagt? (20)

Comparison of-foss-distributed-storage
Comparison of-foss-distributed-storageComparison of-foss-distributed-storage
Comparison of-foss-distributed-storage
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
PostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFSPostgreSQL on EXT4, XFS, BTRFS and ZFS
PostgreSQL on EXT4, XFS, BTRFS and ZFS
 
PostgreSQL + ZFS best practices
PostgreSQL + ZFS best practicesPostgreSQL + ZFS best practices
PostgreSQL + ZFS best practices
 
Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021Let's trace Linux Lernel with KGDB @ COSCUP 2021
Let's trace Linux Lernel with KGDB @ COSCUP 2021
 
First Responder Course - Session 10 - Static Evidence Collection [2004]
First Responder Course - Session 10 - Static Evidence Collection [2004]First Responder Course - Session 10 - Static Evidence Collection [2004]
First Responder Course - Session 10 - Static Evidence Collection [2004]
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
Archiving in linux tar
Archiving in linux tarArchiving in linux tar
Archiving in linux tar
 
Compression Commands in Linux
Compression Commands in LinuxCompression Commands in Linux
Compression Commands in Linux
 
LizardFS-WhitePaper-Eng-v3.9.2-web
LizardFS-WhitePaper-Eng-v3.9.2-webLizardFS-WhitePaper-Eng-v3.9.2-web
LizardFS-WhitePaper-Eng-v3.9.2-web
 
Log
LogLog
Log
 
High Availability With DRBD & Heartbeat
High Availability With DRBD & HeartbeatHigh Availability With DRBD & Heartbeat
High Availability With DRBD & Heartbeat
 
A Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry PiA Journey to Boot Linux on Raspberry Pi
A Journey to Boot Linux on Raspberry Pi
 
Comparison of foss distributed storage
Comparison of foss distributed storageComparison of foss distributed storage
Comparison of foss distributed storage
 
Software Packaging for Cross OS Distribution
Software Packaging for Cross OS DistributionSoftware Packaging for Cross OS Distribution
Software Packaging for Cross OS Distribution
 
KCC_Final.pdf
KCC_Final.pdfKCC_Final.pdf
KCC_Final.pdf
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Performance comparison of Distributed File Systems on 1Gbit networks
Performance comparison of Distributed File Systems on 1Gbit networksPerformance comparison of Distributed File Systems on 1Gbit networks
Performance comparison of Distributed File Systems on 1Gbit networks
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
Raj linux
Raj linux Raj linux
Raj linux
 

Andere mochten auch

Andere mochten auch (11)

Linux CLI
Linux CLILinux CLI
Linux CLI
 
Windows7 Vs Linux
Windows7 Vs LinuxWindows7 Vs Linux
Windows7 Vs Linux
 
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 proc
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginners
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 vi
 
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account management
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filter
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation reading
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 

Ähnlich wie Linux fundamental - Chap 10 fs

TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
Shu-Yu Fu
 
Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "
Tanya Denisyuk
 

Ähnlich wie Linux fundamental - Chap 10 fs (20)

Unix Administration 4
Unix Administration 4Unix Administration 4
Unix Administration 4
 
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
 
FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016FreeBSD Portscamp, Kuala Lumpur 2016
FreeBSD Portscamp, Kuala Lumpur 2016
 
Batel f re v66
Batel f re v66Batel f re v66
Batel f re v66
 
Grub and dracut ii
Grub and dracut iiGrub and dracut ii
Grub and dracut ii
 
Disk and File System Management in Linux
Disk and File System Management in LinuxDisk and File System Management in Linux
Disk and File System Management in Linux
 
Part 4 of 'Introduction to Linux for bioinformatics': Managing data
Part 4 of 'Introduction to Linux for bioinformatics': Managing data Part 4 of 'Introduction to Linux for bioinformatics': Managing data
Part 4 of 'Introduction to Linux for bioinformatics': Managing data
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2
 
2.1 design hard disk layout v2
2.1 design hard disk layout v22.1 design hard disk layout v2
2.1 design hard disk layout v2
 
logical volume manager.ppt
logical volume manager.pptlogical volume manager.ppt
logical volume manager.ppt
 
Linux
LinuxLinux
Linux
 
Storage Management in Linux OS.ppt
Storage Management in Linux OS.pptStorage Management in Linux OS.ppt
Storage Management in Linux OS.ppt
 
kbrgwillis.pdf
kbrgwillis.pdfkbrgwillis.pdf
kbrgwillis.pdf
 
TLPI Chapter 14 File Systems
TLPI Chapter 14 File SystemsTLPI Chapter 14 File Systems
TLPI Chapter 14 File Systems
 
Containers with systemd-nspawn
Containers with systemd-nspawnContainers with systemd-nspawn
Containers with systemd-nspawn
 
4.1 create partitions and filesystems
4.1 create partitions and filesystems4.1 create partitions and filesystems
4.1 create partitions and filesystems
 
Ch12
Ch12Ch12
Ch12
 
FUSE Filesystems
FUSE FilesystemsFUSE Filesystems
FUSE Filesystems
 
Tuning Linux for Databases.
Tuning Linux for Databases.Tuning Linux for Databases.
Tuning Linux for Databases.
 
Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "Алексей Лесовский "Тюнинг Linux для баз данных. "
Алексей Лесовский "Тюнинг Linux для баз данных. "
 

Mehr von Kenny (netman)

Mehr von Kenny (netman) (16)

rpi_audio configuration steps
rpi_audio configuration stepsrpi_audio configuration steps
rpi_audio configuration steps
 
Rpi audio
Rpi audioRpi audio
Rpi audio
 
Chap 19 web
Chap 19 webChap 19 web
Chap 19 web
 
Chap 18 net
Chap 18 netChap 18 net
Chap 18 net
 
About the Course
About the CourseAbout the Course
About the Course
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System Rescue
 
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingLinux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job Scheduling
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 boot
 
Linux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shellLinux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shell
 
Linux system security
Linux system securityLinux system security
Linux system security
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network Monitoring
 
加密應用(GPG)
加密應用(GPG)加密應用(GPG)
加密應用(GPG)
 
金鑰管理 (PKI)
金鑰管理 (PKI)金鑰管理 (PKI)
金鑰管理 (PKI)
 
Linux firewall
Linux firewallLinux firewall
Linux firewall
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Kürzlich hochgeladen (20)

ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Linux fundamental - Chap 10 fs

  • 1. Chapter 10Chapter 10 File SystemFile System Ref. Pge. 126
  • 2. Block DeviceBlock Device ● Block DeviceBlock Device – Allows random accessAllows random access – Divided into blocksDivided into blocks ● Typical Block DeviceTypical Block Device – Hard DiskHard Disk – Floppy DiskFloppy Disk – Optical DiskOptical Disk – Virtual Block DeviceVirtual Block Device
  • 3. Hard DiskHard Disk ● Naming ConventionNaming Convention – IDE:IDE: hda, hdb, …hda, hdb, … – SCSI/SATA:SCSI/SATA: sda, sdb, ...sda, sdb, ... master slave 1st Channel hda hdb 2nd Channel hdc hdd Ref. Pge. 127
  • 4. Hard Disk PartitionHard Disk Partition ● Partitioning rules:Partitioning rules: – Divided by cylinderDivided by cylinder – Maximum of four Primary PartitionsMaximum of four Primary Partitions – Only one of primary partitions may beOnly one of primary partitions may be used as an Extended Partitionused as an Extended Partition – An extended partition contains numbersAn extended partition contains numbers of Logical Partitionof Logical Partition – Only primary and logical partitions can beOnly primary and logical partitions can be populated with file systemspopulated with file systems Ref. Pge. 130
  • 5. Partition Numbering RulesPartition Numbering Rules ● Primary / Extended Partition:Primary / Extended Partition: – 1 ~ 41 ~ 4 ● Logical Partition:Logical Partition: – 5 up5 up Ref. Pge. 132
  • 6. Partitioning ToolPartitioning Tool ● fdisk <disk>fdisk <disk> – Performs disk partitioningPerforms disk partitioning – Common options:Common options: ● ­l­l : view partition information: view partition information Ref. Pge. 139
  • 7. UsingUsing fdiskfdisk ● InternalInternal fdiskfdisk commandscommands – mm : help: help – pp : prints partition table: prints partition table – nn : creates new partition: creates new partition – ll : lists partition type ID: lists partition type ID – tt : changes partition type ID: changes partition type ID – dd : deletes partition: deletes partition – ww : save and exit: save and exit – qq : quit without saving: quit without saving
  • 8. Loop DeviceLoop Device ● Access a file as a block deviceAccess a file as a block device # dd if=/dev/zero of=mydisk bs=1M count=32# dd if=/dev/zero of=mydisk bs=1M count=32
  • 9. File SystemFile System ● Linux supports many types of fileLinux supports many types of file system:system: – Ext2, Ext3, Ext4Ext2, Ext3, Ext4 – ReiserfsReiserfs – JFSJFS – XFSXFS – FAT, NTFSFAT, NTFS – ISO9660ISO9660 – ...... Ref. Pge. 142
  • 10. Ext2 File SystemExt2 File System ● Partition divided into blocks withPartition divided into blocks with fixed block size (1k, 2k, 4k)fixed block size (1k, 2k, 4k) ● Block usages:Block usages: – SuperblockSuperblock – Inode BlocksInode Blocks – Data BlocksData Blocks
  • 11. Super BlockSuper Block ● The first block of a file systemThe first block of a file system ● May have a couple of copiesMay have a couple of copies ● Contains general information:Contains general information: – Block SizeBlock Size – Pointers to free inodesPointers to free inodes – Pointers to free blocksPointers to free blocks – Pointer to root directoryPointer to root directory – Mounting timeMounting time – ......
  • 12. Inode (Index Node)Inode (Index Node) ● 128 bytes for each128 bytes for each ● Contains file information:Contains file information: – OwnershipOwnership – PermissionPermission – File TypeFile Type – Time StampsTime Stamps – Pointers to blocksPointers to blocks
  • 13. Data BlockData Block ● Regular File:Regular File: – The actual dataThe actual data ● Directory:Directory: – File NameFile Name – Inode NumberInode Number
  • 14. File SeekingFile Seeking Superblock Inode Table ● For a path:For a path: – /d1/f1/d1/f1 d1: 1234 d2: 2345 d3: 3456 f1: 4567 f2: 5678 f3: 6789 xxx xxxx xxx ... ... Block: 3654 ... ... Block: 9753 ... d1 f1/ Inode 1234 Inode 4567 Data Block
  • 15. File System FeaturesFile System Features ● Journaling:Journaling: – Keeps a journal of file operationKeeps a journal of file operation – Makes recovery much fasterMakes recovery much faster ● ACL:ACL: – More flexible control above traditionalMore flexible control above traditional permission schemepermission scheme ● Label:Label: – Allows to use label name and regardlessAllows to use label name and regardless changing of device namechanging of device name
  • 16. Creating File SystemCreating File System ● mkfs partitionmkfs partition – Makes file system on partitionMakes file system on partition – Common options:Common options: ● ­t ­t : file system type: file system type ● ­b ­b : block size: block size ● ­i ­i : inode ratio to block: inode ratio to block ● ­j ­j : turn on journal: turn on journal ● ­c ­c : check bad blocks: check bad blocks Ref. Pge. 145
  • 17. Mounting File SystemMounting File System ● mount device /mount/pointmount device /mount/point – The device must be formatedThe device must be formated – The mount point must be an empty directoryThe mount point must be an empty directory – Displays current mounting file systems if noDisplays current mounting file systems if no argument givenargument given – Common options:Common options: ● ­t ­t : file system type: file system type ● ­­bind ­­bind : mounts directory instead of device: mounts directory instead of device ● ­o m_opts ­o m_opts : mount options: mount options Ref. Pge. 160
  • 18. Common Mount OptionsCommon Mount Options ● ro/rw : read and ro/rw : read and writewrite ● sync/async : sync/async : synchronizationsynchronization ● atime/noatim : atime/noatim : access time updatingaccess time updating ● dev/nodev : dev/nodev : device accessdevice access ● exec/noexec : exec/noexec : program runningprogram running ● suid/nosuid : suid/nosuid : suid/sgid functionsuid/sgid function ● remount,m_opt : remount,m_opt : changes mount options on achanges mount options on a mounted file systemmounted file system
  • 19. TheThe /etc/fstab/etc/fstab ● Mount files systems on startupMount files systems on startup ● While runningWhile running mount ­amount ­a ● Fields:Fields: – Device Name/ID (shown by runningDevice Name/ID (shown by running blkidblkid)) – Mount pointMount point – File system typeFile system type – Mount optionsMount options – dumpdump settings (0 for off and 1 for on)settings (0 for off and 1 for on) – fsckfsck settings (1 for root and 2 for others, 0 for off)settings (1 for root and 2 for others, 0 for off) Ref. Pge. 164
  • 20. Example ofExample of /etc/fstab/etc/fstab proc /proc proc nodev,noexec,nosuid 0 0proc /proc proc nodev,noexec,nosuid 0 0 /dev/mapper/system­root / ext4 errors=remount­ro 0 1/dev/mapper/system­root / ext4 errors=remount­ro 0 1 LABEL=/boot /boot ext2 defaults 0 2LABEL=/boot /boot ext2 defaults 0 2 /dev/mapper/system­home /home reiserfs defaults 0 2/dev/mapper/system­home /home reiserfs defaults 0 2 /dev/mapper/system­swap none swap sw 0 0/dev/mapper/system­swap none swap sw 0 0
  • 21. Unmounting File SystemUnmounting File System ● umount <device|/mount/point>umount <device|/mount/point> – Device must be unmounted before detachingDevice must be unmounted before detaching – Device is not being used (check withDevice is not being used (check with fuserfuser):): ● Opening filesOpening files ● Running programRunning program ● Working directoryWorking directory Ref. Pge. 163
  • 22. Swap SpaceSwap Space ● Frees out real memory by swapping outFrees out real memory by swapping out unused pages to diskunused pages to disk ● Swap pages in when reuseSwap pages in when reuse ● Impacting performance by high swappingImpacting performance by high swapping ● Partition ID is 82Partition ID is 82 Ref. Pge. 147
  • 23. Swap CommandsSwap Commands ● mkswap <partition>mkswap <partition> – Formats partition as swap spaceFormats partition as swap space ● swapon <partition>swapon <partition> – Turns on swap spaceTurns on swap space ● swapoff <partition>swapoff <partition> – Turns off swap spaceTurns off swap space ● freefree – Displays memory usagesDisplays memory usages
  • 24. Checking FilesystemChecking Filesystem ● fsck <device>fsck <device> – Examines file system and fixes errorsExamines file system and fixes errors – Common optionsCommon options ● ­A ­A : checks all file system: checks all file system ● ­N ­N : test only: test only ● ­y ­y : always answer YES: always answer YES
  • 25. Monitor File System UseMonitor File System Use ● dfdf – Displays summary of disk spaceDisplays summary of disk space – Common optionsCommon options ● ­h ­h : human readable format: human readable format ● dudu – Displays directory consummation on diskDisplays directory consummation on disk – Common optionsCommon options ● ­h ­h : human readable format: human readable format ● ­s ­s : summary of directories only: summary of directories only Ref. Pge. 155/156
  • 26. Quota ConceptQuota Concept ● Limitation of data consumption for aLimitation of data consumption for a user/group in a file systemuser/group in a file system ● Based on block or inode usageBased on block or inode usage ● Two types of limit:Two types of limit: – Soft Limit: warning onlySoft Limit: warning only – Hard Limit: errorHard Limit: error – Grace Period: how long the soft limit may beGrace Period: how long the soft limit may be exceeded, rechargeableexceeded, rechargeable Ref. Pge. 205
  • 27. Quota ImplementationQuota Implementation ● Modify the option field ofModify the option field of /etc/fstab/etc/fstab # defaults# defaults,usrquota,grpquota,usrquota,grpquota ● Create record files:Create record files: # touch /mount/point/aquota.{user,group}# touch /mount/point/aquota.{user,group} ● Remount file systemRemount file system # mount ­o remount /mount/point# mount ­o remount /mount/point ● Calculate current useCalculate current use # quotacheck /mount/point# quotacheck /mount/point ● Turn on quotaTurn on quota # quotaon /mount/point# quotaon /mount/point
  • 28. Quota ConfigurationQuota Configuration ● edquota ­u <user>edquota ­u <user> Filesystem blocks soft hard inodes soft hardFilesystem blocks soft hard inodes soft hard devicedevice 10600  20000 25000   207 0  010600  20000 25000   207 0  0 ● edquota ­g <group>edquota ­g <group> – Edits group quotaEdits group quota ● edquota ­tedquota ­t – Edits grace timeEdits grace time ● edquota ­p user1 ­u user2 edquota ­p user1 ­u user2  – Copies quota settingsCopies quota settings
  • 29. Quota InformationQuota Information ● quotaquota – Reports quota usageReports quota usage – A regular user can only views her/his own quotaA regular user can only views her/his own quota ● repquota <device>repquota <device> – Root onlyRoot only – Reports quotas for all users and groupsReports quotas for all users and groups – Common optionsCommon options ● -u : displays user quota report-u : displays user quota report ● -g : displays group quota report-g : displays group quota report ● -a : all devices if no device specified-a : all devices if no device specified