1

If we see the size of sdb2 is 39.5GB in fdisk whereas 1k in the lsblk output. What can be the reason for this?

Disk /dev/sdb: 300 GiB, 322122547200 bytes, 629145600 sectors
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: dos
Disk identifier: 0x674589c1

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sdb1  *       2048   999423   997376  487M 83 Linux
/dev/sdb2       1001470 83884031 82882562 39.5G  5 Extended
/dev/sdb5       1001472 83884031 82882560 39.5G 8e Linux LVM


root@ubuntu1604:~# lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0                         2:0    1    4K  0 disk
sda                         8:0    0  300G  0 disk
sdb                         8:16   0  300G  0 disk
├─sdb1                      8:17   0  487M  0 part /boot
├─sdb2                      8:18   0    1K  0 part
└─sdb5                      8:21   0 39.5G  0 part
  ├─ubuntu1604--vg-root   252:0    0 35.5G  0 lvm  /
  └─ubuntu1604--vg-swap_1 252:1    0    4G  0 lvm  [SWAP]
sr0                        11:0    1 1024M  0 rom
root@ubuntu1604:~#
  • 2 sectors is 1024 bytes. What difference are you seeing? Look where sdb5 starts. – stark Apr 16 '21 at 12:16
  • @stark I understand that the sdb2 starts at 1001470 and sd5 starts at 1001472, thus 2 sectors. This will add a follow-up question, What would be the significance of the Start and end sectors here? both of these parts (sdb2 and sdb5) spread across 1001470 >> 83884031, thus resulting in 39.5G size. – Shailesh Suryawanshi Apr 16 '21 at 15:09
  • 1
    When you have overlapping partitions, lsblk shows the space allocated to only one partition so the total matches the disk size. fdisk shows the partition sizes regardless of overlap. Obviously you can't use both partitions at the same time. – stark Apr 16 '21 at 15:37

1 Answers1

1

lsblk shows size in IEC units (GiB, MiB, etc). A gibibyte (GiB) is larger than a gigabyte (GB)
fdisk shows size in SI (GB, MB, etc).