0

I have an old laptop that has been running Ubuntu 10.04 since it was released, and I've really forgotten all about it's contents. I'd like to avoid any downtime if possible, however I discovered the following output from fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00068a66

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          32      248832   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              32       30402   243947521    5  Extended
/dev/sda5              32       30402   243947520   8e  Linux LVM

The top part says 250Gb quite clearly, but there seems to be sda2 and sda5 both seemingly holding ~243Gb each. Is this really just a 250Gb drive or is there another partition I'm simply not making use of? Here's the contents of df -h fwiw:

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/dandell-root
                      227G  121G   94G  57% /
none                  491M  276K  491M   1% /dev
none                  496M     0  496M   0% /dev/shm
none                  496M  692K  495M   1% /var/run
none                  496M     0  496M   0% /var/lock
none                  496M     0  496M   0% /lib/init/rw
none                  227G  121G   94G  57% /var/lib/ureadahead/debugfs
/dev/sda1             228M   36M  181M  17% /boot

I have no desire to maintain the partition, and would like to merge them. The server is headless so command-line only please :) Thanks for any advice!

UPDATE: OK I satisfied my curiosity that the drive is really only 250Gb with sudo hdparm -I /dev/sda. However I'm still interested to interpret the output of fdisk -l above?

3 Answers 3

2

The disk has just 250GB, if you look at the start and end cylinders, you'll see that they are the same.

/dev/sda2 is just an extended partition, which is a fancy way of saying 'a container for other partitions'. Contained in that extended partition is an LVM volume (/dev/sda5), which in turn holds your data.

Extended partitions are a workaround for the inability of hard disks with MS-DOS type partition tables to hold more than 4 partition entries. With GPT, there's no need for them anymore.

0
1
/dev/sda2              32       30402   243947521    5  Extended
/dev/sda5              32       30402   243947520   8e  Linux LVM

As you can see, sda2 is an extended partition and starts at 32. sda5 starts at 32, too.
Normaly you can just have up to 4 primary partitions on your disk (btw: Does anyone knows the reason?)
A extended partition is something like a "container" in which you can create more partitions.
So sda5 is a partition inside sda2.

But since sda5 takes all space in sda2 (you can see it at start and endpoints), I think sda2 is more or less useless and you could move sda5 outside if sda2 and then remove sda2. But I don't know if, and how, this is possible

1

Because /dev/sda2 is an Extended partition, it is not actually usable for data storage. You'll note that both /dev/sda2 and /dev/sda5 in the list, have the same values under the Start and End columns, and only differ in Blocks by one. Extended partitions are used to allow creating more partitions than would normally be allowed in the partition table. The fdisk (and similar) application does not show it well, but in your case, /dev/sda5 is actually inside the /dev/sda2 partition.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .