SlideShare a Scribd company logo
Embora  seja  fora  de  âmbito  com  relação  directa  nas  especificidades  do  hardware,  possui 
algum  enquadramento  pertinente  na  melhor  conceptualização  e  contextualização  de 
aspectos relacionados com o Linux (e com todos os SO’s). 
 
Nesse sentido fruto do nosso diálogo em sessão, segue alguns aspectos que colectei para de 
forma sucinta contextualizarem e eventualmente corrigirem alguma imprecisão que tenha 
sido mal esclarecida.  
Na  relação  que  existe  com  nos  discos  rígidos,  entre  sectores,  blocos  e  taxa  perdida  de 
endereçamento lógico dos ficheiros nos blocos. 
 
1. On  reading  through  disc  structure,  it  states  that  blocks  size  is  a  multiple  of  sector  size.  First 
thought is why do you even need blocks when there are sectors, and secondly why is the block 
size a multiple of sector like 1,2,4? Why can't it be half of sector? What's the relation here? 
Early in the computing industry, the term "block" was loosely used to refer to a small chunk of data. 
Later the term referring to the data area was replaced by sector, and block became associated with the 
data  packets  that  are  passed  in  various  sizes  by  different  types  of  data  streams. 
http://en.wikipedia.org/wiki/Disk_sector 
Block  is  an  abstraction  of  filesystems.  All  filesystem  operations  can  be  accessed  only  in  multiple  of 
blocks. In other terms, the smallest logically addressable unit to filesystem is block, not a sector. 
The smallest addressable unit on a block device is a sector. The sector size is physical property of a 
block device and is the fundamental unit of all block devices. 
Most block devices have 512‐byte sectors (although other sizes are common. For example, some CD‐
ROM discs have 2‐kilobyte sectors) while block sizes are commonly of size 512 bytes, 1 KB or 4KB. This is 
the reason block size is a multiple of sector. 
 
2. Disk Sector and Wasted Block Allocation For Files. 
A  sector  is  a unit  normally 512 bytes  or 1k, 2k, 4k…  with  relation  to  space  in disk  hardware. 
Filesystem block size is group of sector size.  
Suppose I am storing a file which is 5KB, how this will be written onto disk if a sector is 512 bytes 
and block is 4KB? 4KB of that File is written into one block and another 1KB of file is written into 
antoher 4KB Block. Now 3KB of that second Block is unusable. Will it be usable in future or will it 
be wasted? If I write the 10 5KB file to disk, 30KB of size will be wasted, or this 30KB is used in 
disk usage? 
First thing to note, is that the block size is almost always larger than your sector size 
To determine sector size run the following command 
root@ubuntu:~# fdisk ‐l | grep ‐E "Sector size" 
Sector size (logical/physical): 512 bytes / 512 bytes 
Sector size will almost always be either 512 bytes or 4096 bytes. 
 
To determine block size, run the following command
root@ubuntu:~# blockdev ‐‐getbsz /dev/sda 
4096 
The block size will often be 4096 on most modern OSes. You can change this if desired 
Any files that do not completely fill a block, will result in wasted space. This is normal and expected. 
http://linux.die.net/man/8/blockdev 
http://serverfault.com/questions/29887/how‐do‐i‐determine‐the‐block‐size‐of‐an‐ext3‐partition‐on‐linux 
http://www.linuxforums.org/forum/miscellaneous/5654‐linux‐disk‐block‐size‐help‐please.html 
Its a well established fact that files are stored on disk in multiples of "block" size. 
 
 
 
The concept of a block began as a simple way for physical sectors on disk to be represented logically in 
the filesystem. Each sector had its own header, data area and ECC which made it the smallest piece of 
disk that could be independently represented logically. 
As  time  went by,  with  the  advent  of caches  on  the  HDD  controller  it  became  easier  to  have  logical 
blocks which were of the size of multiple physical sectors. This way on‐disk sequential I/O increased 
resulting in better throughput. 
Today, a block is the smallest piece of disk‐space available. Typically files are stored using 1 or more 
block(s) on disk. 
 
For  each  file,  the  leftover  space  (if  any)  in  the  last 
block is used whenever changes are made to the file 
and  it  "grows",  requiring  additional  disk‐space  to 
store the newly added content. 
Additional space requirement (beyond what the free 
space in the current last block can accommodate) is 
satisfied by requesting additional blocks on the disk 
and logically linking the new set of blocks to continue 
following the current last block of the file. 
File A illustrates the above scenario.   
Advantage  of  allocating  blocks  in  advance  is  that  fragmentation  is  reduced.  Consider  the  alternative 
where there is no concept of blocks on disk and disk‐space is allocated as required i.e the amount of disk 
space allocated is exactly the file size. 
In such a setup, each time even a single character is added to the file, one would need to : 
 Allocate additional memory (1 more character). 
 Setup a link between the area containing the initial area of the file and this new byte. 
 
All this meta‐data i.e. additional formation about the "links" requires disk‐space too. This constitutes a 
fixed  overhead  for  each  such  "link"  and  hence  its  imperative  that  such  "links"  be  kept  to  a  minimal 
number. The concept of allocating disk size in "blocks" limits the overhead to a pre‐determined amount. 
Guaranteed number of files on disk = Raw disk‐space / block‐size 
Also  such  random  seeking  reduces  throughput  as  repositioning  the  disk  head  is  the  most  time‐
consuming task involved in disk I/O. Frequent random seeking is also likely to wear out the disk faster 
(remember dancing HDDs?) and must be avoided as much as possible. 
Further advantages of this approach : 
1. Faster reads ‐ Using blocks, disk reads are sequential upto the block size. Less seeks = higher read 
throughput. 
2. Faster Writes ‐ Blocks provide a simple implementation that can be mapped to pages which results 
in higher write throughput as well. 

More Related Content

PPT
2.4.1 use debian package management v2
PPT
2.4.0 software installation v2
PDF
3.1.d manual bash script guide lsstv 2.0r11
PPT
4.2 maintain the integrity of filesystems
PPT
3.7 search text files using regular expressions
PPT
3.3 perform basic file management
PPT
3.4 use streams, pipes and redirects v2
PPT
3.1.c apend scripting, crond, atd
2.4.1 use debian package management v2
2.4.0 software installation v2
3.1.d manual bash script guide lsstv 2.0r11
4.2 maintain the integrity of filesystems
3.7 search text files using regular expressions
3.3 perform basic file management
3.4 use streams, pipes and redirects v2
3.1.c apend scripting, crond, atd

Viewers also liked (16)

PPT
3.2 process text streams using filters
PDF
3.1.b how to - colors and prompts in bash
PPT
2.5 use rpm and yum package management
PDF
01.08.15
PPTX
Music Video Coursework - Digipak Analysis
PDF
Portafolio digital de-aprendizaje
PPT
2.2 install boot manager
PPT
3.6 modify process execution priorities v2
PPTX
La pobreza
DOCX
Dissertation
PPT
3.1 gnu and unix commands v4
PPT
2.3 manage shared libraries
PDF
Proposta m5s scenario4
PPTX
Word power championship 2013
PPTX
El CERRO HORNACHUELOS
DOCX
Lecciones 1qui 2p
3.2 process text streams using filters
3.1.b how to - colors and prompts in bash
2.5 use rpm and yum package management
01.08.15
Music Video Coursework - Digipak Analysis
Portafolio digital de-aprendizaje
2.2 install boot manager
3.6 modify process execution priorities v2
La pobreza
Dissertation
3.1 gnu and unix commands v4
2.3 manage shared libraries
Proposta m5s scenario4
Word power championship 2013
El CERRO HORNACHUELOS
Lecciones 1qui 2p
Ad

Similar to 1.1.b hdd block sector (20)

PDF
On no sql.partiii
PPTX
Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...
PDF
[2C6]SQLite DB 의 입출력 특성분석 : Android 와 Tizen 사례
PPTX
MS Cloud Day - Building web applications with Azure storage
PPTX
What is Object storage ?
PDF
Cache And Interconnect Architectures In Multiprocessors Softcover Reprint Of ...
PDF
Extentnumbers
PPSX
Sample database design methodology
DOC
All .net Interview questions
PDF
Sql project ..
PDF
5231 140-hellwig
PDF
Evaluation Criteria for Selecting NoSQL Databases in a Single Box Environment
PDF
EVALUATION CRITERIA FOR SELECTING NOSQL DATABASES IN A SINGLE-BOX ENVIRONMENT
PPTX
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
PPTX
_TCS Technical questions all tcs question
PPTX
_TCS Technical questions all tcs question
PDF
Modeling data and best practices for the Azure Cosmos DB.
PDF
KEY
2012 phoenix mug
PDF
SQL vs NoSQL deep dive
On no sql.partiii
Cloud Architecture Patterns for Mere Mortals - Bill Wilder - Vermont Code Cam...
[2C6]SQLite DB 의 입출력 특성분석 : Android 와 Tizen 사례
MS Cloud Day - Building web applications with Azure storage
What is Object storage ?
Cache And Interconnect Architectures In Multiprocessors Softcover Reprint Of ...
Extentnumbers
Sample database design methodology
All .net Interview questions
Sql project ..
5231 140-hellwig
Evaluation Criteria for Selecting NoSQL Databases in a Single Box Environment
EVALUATION CRITERIA FOR SELECTING NOSQL DATABASES IN A SINGLE-BOX ENVIRONMENT
UNIT 3 Memory Design for SOC.ppUNIT 3 Memory Design for SOC.pptx
_TCS Technical questions all tcs question
_TCS Technical questions all tcs question
Modeling data and best practices for the Azure Cosmos DB.
2012 phoenix mug
SQL vs NoSQL deep dive
Ad

More from Acácio Oliveira (20)

PPTX
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
PPTX
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
PPTX
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
PPTX
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
PPTX
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
PPTX
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
PPTX
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
PPTX
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
PPTX
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
PPTX
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
PPTX
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
PPTX
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
PPTX
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
PPTX
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
PPTX
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
PPTX
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
PPTX
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptx
PPTX
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
PPTX
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
PPTX
Security+ Lesson 01 Topic 17 - Types of Malware.pptx
Security+ Lesson 01 Topic 24 - Vulnerability Scanning vs Pen Testing.pptx
Security+ Lesson 01 Topic 25 - Application Security Controls and Techniques.pptx
Security+ Lesson 01 Topic 21 - Types of Application Attacks.pptx
Security+ Lesson 01 Topic 19 - Summary of Social Engineering Attacks.pptx
Security+ Lesson 01 Topic 23 - Overview of Security Assessment Tools.pptx
Security+ Lesson 01 Topic 20 - Summary of Wireless Attacks.pptx
Security+ Lesson 01 Topic 22 - Security Enhancement Techniques.pptx
Security+ Lesson 01 Topic 15 - Risk Management Best Practices.pptx
Security+ Lesson 01 Topic 13 - Physical Security and Environmental Controls.pptx
Security+ Lesson 01 Topic 14 - Disaster Recovery Concepts.pptx
Security+ Lesson 01 Topic 06 - Wireless Security Considerations.pptx
Security+ Lesson 01 Topic 04 - Secure Network Design Elements and Components....
Security+ Lesson 01 Topic 02 - Secure Network Administration Concepts.pptx
Security+ Lesson 01 Topic 01 - Intro to Network Devices.pptx
Security+ Lesson 01 Topic 08 - Integrating Data and Systems with Third Partie...
Security+ Lesson 01 Topic 07 - Risk Related Concepts.pptx
Security+ Lesson 01 Topic 05 - Common Network Protocols.pptx
Security+ Lesson 01 Topic 11 - Incident Response Concepts.pptx
Security+ Lesson 01 Topic 12 - Security Related Awareness and Training.pptx
Security+ Lesson 01 Topic 17 - Types of Malware.pptx

Recently uploaded (20)

PPTX
Tartificialntelligence_presentation.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
A Presentation on Artificial Intelligence
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Mushroom cultivation and it's methods.pdf
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Machine learning based COVID-19 study performance prediction
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Tartificialntelligence_presentation.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Per capita expenditure prediction using model stacking based on satellite ima...
A Presentation on Artificial Intelligence
TLE Review Electricity (Electricity).pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
A comparative study of natural language inference in Swahili using monolingua...
Mushroom cultivation and it's methods.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
OMC Textile Division Presentation 2021.pptx
Network Security Unit 5.pdf for BCA BBA.
Group 1 Presentation -Planning and Decision Making .pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
SOPHOS-XG Firewall Administrator PPT.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Assigned Numbers - 2025 - Bluetooth® Document
Machine learning based COVID-19 study performance prediction
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...

1.1.b hdd block sector

  • 1. Embora  seja  fora  de  âmbito  com  relação  directa  nas  especificidades  do  hardware,  possui  algum  enquadramento  pertinente  na  melhor  conceptualização  e  contextualização  de  aspectos relacionados com o Linux (e com todos os SO’s).    Nesse sentido fruto do nosso diálogo em sessão, segue alguns aspectos que colectei para de  forma sucinta contextualizarem e eventualmente corrigirem alguma imprecisão que tenha  sido mal esclarecida.   Na  relação  que  existe  com  nos  discos  rígidos,  entre  sectores,  blocos  e  taxa  perdida  de  endereçamento lógico dos ficheiros nos blocos.    1. On  reading  through  disc  structure,  it  states  that  blocks  size  is  a  multiple  of  sector  size.  First  thought is why do you even need blocks when there are sectors, and secondly why is the block  size a multiple of sector like 1,2,4? Why can't it be half of sector? What's the relation here?  Early in the computing industry, the term "block" was loosely used to refer to a small chunk of data.  Later the term referring to the data area was replaced by sector, and block became associated with the  data  packets  that  are  passed  in  various  sizes  by  different  types  of  data  streams.  http://en.wikipedia.org/wiki/Disk_sector  Block  is  an  abstraction  of  filesystems.  All  filesystem  operations  can  be  accessed  only  in  multiple  of  blocks. In other terms, the smallest logically addressable unit to filesystem is block, not a sector.  The smallest addressable unit on a block device is a sector. The sector size is physical property of a  block device and is the fundamental unit of all block devices.  Most block devices have 512‐byte sectors (although other sizes are common. For example, some CD‐ ROM discs have 2‐kilobyte sectors) while block sizes are commonly of size 512 bytes, 1 KB or 4KB. This is  the reason block size is a multiple of sector.    2. Disk Sector and Wasted Block Allocation For Files.  A  sector  is  a unit  normally 512 bytes  or 1k, 2k, 4k…  with  relation  to  space  in disk  hardware.  Filesystem block size is group of sector size.   Suppose I am storing a file which is 5KB, how this will be written onto disk if a sector is 512 bytes  and block is 4KB? 4KB of that File is written into one block and another 1KB of file is written into  antoher 4KB Block. Now 3KB of that second Block is unusable. Will it be usable in future or will it  be wasted? If I write the 10 5KB file to disk, 30KB of size will be wasted, or this 30KB is used in  disk usage?  First thing to note, is that the block size is almost always larger than your sector size  To determine sector size run the following command  root@ubuntu:~# fdisk ‐l | grep ‐E "Sector size"  Sector size (logical/physical): 512 bytes / 512 bytes  Sector size will almost always be either 512 bytes or 4096 bytes.    To determine block size, run the following command root@ubuntu:~# blockdev ‐‐getbsz /dev/sda  4096  The block size will often be 4096 on most modern OSes. You can change this if desired  Any files that do not completely fill a block, will result in wasted space. This is normal and expected. 
  • 2. http://linux.die.net/man/8/blockdev  http://serverfault.com/questions/29887/how‐do‐i‐determine‐the‐block‐size‐of‐an‐ext3‐partition‐on‐linux  http://www.linuxforums.org/forum/miscellaneous/5654‐linux‐disk‐block‐size‐help‐please.html  Its a well established fact that files are stored on disk in multiples of "block" size.        The concept of a block began as a simple way for physical sectors on disk to be represented logically in  the filesystem. Each sector had its own header, data area and ECC which made it the smallest piece of  disk that could be independently represented logically.  As  time  went by,  with  the  advent  of caches  on  the  HDD  controller  it  became  easier  to  have  logical  blocks which were of the size of multiple physical sectors. This way on‐disk sequential I/O increased  resulting in better throughput.  Today, a block is the smallest piece of disk‐space available. Typically files are stored using 1 or more  block(s) on disk.    For  each  file,  the  leftover  space  (if  any)  in  the  last  block is used whenever changes are made to the file  and  it  "grows",  requiring  additional  disk‐space  to  store the newly added content.  Additional space requirement (beyond what the free  space in the current last block can accommodate) is  satisfied by requesting additional blocks on the disk  and logically linking the new set of blocks to continue  following the current last block of the file.  File A illustrates the above scenario.   
  • 3. Advantage  of  allocating  blocks  in  advance  is  that  fragmentation  is  reduced.  Consider  the  alternative  where there is no concept of blocks on disk and disk‐space is allocated as required i.e the amount of disk  space allocated is exactly the file size.  In such a setup, each time even a single character is added to the file, one would need to :   Allocate additional memory (1 more character).   Setup a link between the area containing the initial area of the file and this new byte.    All this meta‐data i.e. additional formation about the "links" requires disk‐space too. This constitutes a  fixed  overhead  for  each  such  "link"  and  hence  its  imperative  that  such  "links"  be  kept  to  a  minimal  number. The concept of allocating disk size in "blocks" limits the overhead to a pre‐determined amount.  Guaranteed number of files on disk = Raw disk‐space / block‐size  Also  such  random  seeking  reduces  throughput  as  repositioning  the  disk  head  is  the  most  time‐ consuming task involved in disk I/O. Frequent random seeking is also likely to wear out the disk faster  (remember dancing HDDs?) and must be avoided as much as possible.  Further advantages of this approach :  1. Faster reads ‐ Using blocks, disk reads are sequential upto the block size. Less seeks = higher read  throughput.  2. Faster Writes ‐ Blocks provide a simple implementation that can be mapped to pages which results  in higher write throughput as well.