Linux – this 1K logical partition

linuxpartition

I noticed that I have a strange partition under sda3, with a size of 1K. I am about to reformat my hard drive and re-install my OS with Ubuntu 14.04 while creating separate partitions for / and /home.

What is this almost-empty partition, and should I do anything with it? Why is it in lsblk but not in blkid?

[lucas@lucas-ThinkPad-W520]~$ sudo blkid
/dev/sda1: LABEL="SYSTEM_DRV" UUID="30CA6C06CA6BC6A6" TYPE="ntfs" 
/dev/sda2: LABEL="Windows7_OS" UUID="9426707E26706362" TYPE="ntfs" 
/dev/sda4: LABEL="Lenovo_Recovery" UUID="E2CA772DCA76FD5B" TYPE="ntfs" 
/dev/sda5: UUID="7d513625-85de-41b7-9c81-0d3fbc4e6a0f" TYPE="ext4" 
/dev/sda6: UUID="602d2625-8ab9-44e5-b73a-d1f0181f5549" TYPE="swap" 

[lucas@lucas-ThinkPad-W520]~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk
├─sda1   8:1    0   1.5G  0 part /media/lucas/SYSTEM_DRV
├─sda2   8:2    0 262.1G  0 part /media/lucas/Windows7_OS
├─sda3   8:3    0     1K  0 part
├─sda4   8:4    0  15.6G  0 part /media/lucas/Lenovo_Recovery
├─sda5   8:5    0 178.7G  0 part /
└─sda6   8:6    0   7.9G  0 part [SWAP]
sr0     11:0    1  1024M  0 rom

Best Answer

That is almost certainly the extended partition that contains your logical ones. You should be able to confirm by running parted -l (or fdisk -l) as root. For example, on my system:

$ sudo parted -l
Model: ATA ST9500420AS (scsi)
Disk /dev/sda: 500GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type      File system     Flags
 1      32.3kB  41.1MB  41.1MB  primary   fat16           diag
 2      41.9MB  15.8GB  15.7GB  primary   ntfs            boot
 3      15.8GB  99.7GB  83.9GB  primary   ntfs
 4      99.7GB  500GB   400GB   extended                  lba
 5      99.7GB  102GB   2147MB  logical   fat32           lba
 7      102GB   176GB   73.8GB  logical   ext4
 6      176GB   492GB   316GB   logical   ext4
 8      492GB   500GB   8389MB  logical   linux-swap(v1)

Note that sda4 is listed as an extended partition with a size of 400GB. That is the sum of the sizes of the logical partitions it contains (5,7,6 and 8). In the lsblk output, it shows as a 1K partition (because it is not a real, bona fide partition that contains data but an extended one):

$ lsblk 
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0  39.2M  0 part 
├─sda2   8:2    0  14.7G  0 part 
├─sda3   8:3    0  78.1G  0 part /windows
├─sda4   8:4    0     1K  0 part 
├─sda5   8:5    0     2G  0 part 
├─sda6   8:6    0 294.4G  0 part /home
├─sda7   8:7    0  68.7G  0 part /
└─sda8   8:8    0   7.8G  0 part [SWAP]
sr0     11:0    1  1024M  0 rom  

It does not appear in the output of blkid for the same reason, it only lists "real" partitions by default. You can force it to mention the extended one by using the -p flag:

$ sudo blkid -p /dev/sda* | grep sda4
/dev/sda4: PTTYPE="dos" PART_ENTRY_SCHEME="dos" PART_ENTRY_TYPE="0xf" PART_ENTRY_NUMBER="4" PART_ENTRY_OFFSET="194643601" PART_ENTRY_SIZE="782129519" PART_ENTRY_DISK="8:0" 
Related Question