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?


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.

| 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 used 1kB blocks for two decares — the header might as well have read kB. In the context of Linux's fdisk, “block” always means 1kB. The default unit changed in version 2.25, now the unit is sectors of 512 bytes. In expert mode, the unit has always been 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 (but “sectors” is widely used to mean 512 bytes regardless of any physical or logical characteristics of the disk), and GPT partitions are normally aligned on 1MB.

| improve this answer | |
  • Great answer overall. One minor error, maybe. I've found that fdisk from util-linux 2.23 in CentOS 7.2 and in 2.20 in Mint 17 show a Blocks column header and display 512 byte "blocks" in that column unless we give a -b flag and ask for a different block size. – Mike Diehn Oct 7 '16 at 21:12
  • 1
    @MikeDiehn I see, the default display unit changed since I wrote this answer. But if you see “block”, it means 1kB, not 512B. If fdisk uses a 512-byte unit, it calls it “sector”, not “block”. – Gilles 'SO- stop being evil' Oct 8 '16 at 13:01
  • I see it now, @Giles. In the man page for fdisk, the -b is described as setting the sectore size, not the block size. The column header in the output is "Blocks" but that column seems actually to show sectors. – Mike Diehn Dec 16 '16 at 14:46

I don't believe fdisk does do 1k block reports - or that it reports on blocks at all. From the man page:

-u, --units[=unit]

  • When listing partition tables, show sizes in sectors or in cylinders. The default is to show sizes in sectors. For backward compatibility, it is possible to use the option without the unit argument - then the default is used. Note that the optional unit argument cannot be separated from the -u option by a space, the correct form is for example -u=cylinders.

Ok, so fdisk doesn't list output as blocks, then. It uses cylinders or sectors by default. Well, here's what wikipedia has to say about a sector:

In computer disk storage, a sector is a subdivision of a track on a magnetic disk or optical disc. Each sector stores a fixed amount of user-accessible data, traditionally 512 bytes for hard disk drives (HDDs) and 2048 bytes for CD-ROMs and DVD-ROMs. Newer HDDs use 4096-byte (4 KiB) sectors, which are known as the Advanced Format (AF).

Now that makes more sense to me. I had never heard of a 1K sector before, and so stumbling upon this confused me. Some googling though did reveal that there was a small run of Seagate branded drives which shipped for a portion of the year 2005 that did report a sector size of 1K.

And anyway, it's right there in the header output:

Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sector
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: E12A6152-B1E6-4D4A-9799-491B339BA633

Device        Start       End   Sectors  Size Type
/dev/sda1      4096   6197247   6193152    3G EFI System
/dev/sda2   6293504  31459327  25165824   12G Linux filesystem
/dev/sda3  31459328 234441614 202982287 96.8G Linux filesystem

See? Units: sectors of 1 * 512 = 512 bytes...

| improve this answer | |
  • Recent fdisk versions (e.g. on Ubuntu trusty: fdisk (util-linux 2.20.1)) do in fact report blocks instead of sectors, and those blocks are in fact 1KB blocks. – Martin von Wittich Oct 12 '15 at 9:27
  • 1
    @MartinvonWittich - you're wrong. recent fdisks report sectors. – mikeserv Oct 12 '15 at 11:12
  • you might be right, 2.20 seems to be pretty ancient (2012)... which version are you using? – Martin von Wittich Oct 12 '15 at 11:58
  • This is really weird. I'm checking on CentOS 7.2, util-linux 2.23.2, and it's showing a Blocks header and 512 byte blocks: rpm -qf /usr/sbin/fdisk says: util-linux-2.23.2-26.el7_2.3.x86_64 dpkg -l util-linux says: util-linux 2.20.1-5.1ubuntu20.7 – Mike Diehn Oct 7 '16 at 21:07

In my version of Ubuntu 14.04, fdisk lists the partition in blocks but it doesn't tell me how many sectors are in each block. However, it does give the starting and ending sector number for each partition and when I subtract the starting point from the end point, I get exactly twice the number of sectors as there are blocks in the partition. I.e., there are two sectors in each block in Ubuntu 12.04.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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