Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On my machine, fdisk -lu /dev/sda displays following output:

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    73947135    36972544   83  Linux
/dev/sda2        73949182    78139391     2095105    5  Extended
/dev/sda5        73949184    78139391     2095104   82  Linux swap / Solaris

What is this "blocks" unit? Is one "fdisk block" a 1KiB? Where does this unit come from?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You should know some concepts like sector, track, cylinder to understand block. Here is a simple definition:

Blocks and clusters

The Unix communities employ the term block to refer to a sector or group of
sectors. For example, the Linux fdisk utility normally displays partition
table information using 1024-byte blocks, but also uses the word sector to
help describe a disk's size in the phrase, 63 sectors per track.

You can read more in this link.

share|improve this answer

In the first versions of Unix, a block was 512 bytes all the way from the hardware through the filesystem through C code to user tools.

Nowadays there are many different types of hardware and many different filesystems (some of which don't have any notion of block size), so “block size” is an arbitrary definition chosen by each tool. Most traditional Unix systems have retained the 512-byte block size by default for backward compatibility, and this is what POSIX mandates for several commands (dd, du, df, ls, find -size, …). Several GNU/Linux utilities display 1kB units by default (du, df, ls, …) unless invoked in POSIXLY_CORRECT mode. I think the move to 1kB is solely motivated because it's a lot friendlier to humans.

The Linux fdisk utility uses 1kB blocks — the header might as well read kB. In expert mode, the unit is sectors of 512 bytes. 512 byte is a more natural low-level unit for traditional PC disks because they write in 512-byte sectors, and partition boundaries are aligned to 512 bytes, so using 1kB as the unit leads to ½ fractions. Modern large disks have larger sectors, and GPT partitions are normally aligned on 1MB.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.