[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Unusable free space?



On Wed, 17 Mar 2010 10:40:01 -0400 (EDT), Stan Hoeppner wrote:
> Stephen Powell put forth on 3/17/2010 8:20 AM:
>> On Tue, 16 Mar 2010 17:12:49 -0400 (EDT), Aioanei Rares wrote:
>>>
>>> Hi all, I have a HDD (the only one, in fact) with the following layout , 
>>> as reported by df :
>>>
>>> /dev/sda2              99G  886M   93G   1% /
>>> /dev/sda1             2.0G  170M  1.8G   9% /boot
>>> /dev/sda5             345G  232G   96G  71% /home
>>> /dev/sda8              29G  172M   27G   1% /tmp
>>> /dev/sda6              59G  5.2G   54G   9% /usr
>>> /dev/sda7              20G  3.1G   17G  16% /var
>>>
>>> Now, at the end, I have some 137 GB unpartitioned/unformatted. How can I 
>>> use this free space, since gparted ran from a LiveCD tells me that I 
>>> need to make a logical partition (which is /dev/sda4) in order to create 
>>> partitions anew in that free space. It's probably lack of sleep, but 
>>> please help me out here. :)
>>
>> You can still create up to two more primary partitions, providing
> 
> Not necessarily.  He's not showing swap (assuming he's using a partition not
> a file).  If partition, swap is at /dev/sda3, 4, or 9.

You're right.  There may be non-filesystem partitions/logical drives --
one of which, if I understand correctly, is the extended partition.
But the OP said that gparted wanted to create a /dev/sda4.  I'm not
sure if /dev/sda4 came directly from gparted or if the OP *assumed* that
it would be /dev/sda4 and attributed this name to gparted.

>> the space is available outside the extended partition, and these
>> would have names /dev/sda3 and /dev/sda4, respectively.  But there's
>> no way you can create a new logical partition called /dev/sda4.
> 
> Agreed, there's not.  He'd have to make a primary partition to get a device
> name of /dev/sda4.  I'm not sure what you mean by "space is available
> outside the extended partition".  TTBOMK, extended partitions are place
> holders.  They don't own or contain any blocks unless or until you create
> logical partitions after having created an extended partition.  If there is
> still unallocated space anywhere on the block device, and there are both
> unassigned primary and logical partitions available, he can freely use
> either.  For instance, on my vanity server I have a similar situation:
> 
>    http://www.hardwarefreak.com/cfdisk.jpg
>
> I have about 250GB of unallocated space within which I can create two
> additional primary partitions, or unlimited? logical partitions.

Yes, an extended partition is a placeholder.  The only real *data* that
belongs to the extended partition itself, and not to a logical drive
within it, is the partition boot sector, which contains the logical 
drive table.  I.e. it contains the "partition table" for the logical
drives.  I'm using DOS terminology here, by the way, since this
partitioning scheme was invented for DOS.

Nevertheless, the extended partition, like a primary partition,
contains extents (starting cylinder and ending cylinder) in the
main partition table, which is stored in the master boot record.

Let's suppose that I create three logical drives of 100 cylinders
each.  The extended partition, I think, will have to be at least
301 cylinders, and its extent definitions in the main partition table
will have to "cover" all three logical drives.  (Assume that the logical
drives are allocated contiguously.)  The extra cylinder is for the
extended partition boot sector, which is in a cylinder by itself.
(Or maybe it only reserves a track, rather than an entire cylinder.
I don't remember.  I'll have to look that up.  Anyway ...)

Now suppose that I delete the middle logical drive.  There is now
100 cylinders of free space *within* the extended partition.  It can
be used to create a logical drive, but it cannot be used to create
a primary partition because the free space is *inside* the extended
partition.  In order to use that space to create a primary partition,
I would have to use some type of partition maintenance tool to 
move the (former) third logical drive adjacent to the first logical
drive, then reduce the size of the extended partition to release
the 100 cylinders of internal free space, which is now at the tail
end of the extended partition.

If instead I delete the third logical drive, then
no data movement needs to take place to make that space available
for a primary partition.  All that needs to take place is to
reduce the extents of the extended partition in the main partition
table.  Will this take place automatically if I delete the third
logical drive?  Well, that depends on which program is being
used to maintain the partition table / logical drive table.  Some
tools will automatically reduce the size of the extended partition
in these cases.  Others will not.

I used to use a program called Partition Magic.  I'm pretty sure
that these were separate operations in Partition Magic.  One could
delete or reduce the size of the last logical partition without
reducing the size of the extended partition.  This would leave
free space within the extended partition that could not be used
by a primary partition.  If you wanted to use that space for a
primary partition, you had to also reduce the size of the containing
extended partition.

I'm not sure what parted does in this situation.

-- 
  .''`.     Stephen Powell    <zlinuxman@wowway.com>
 : :'  :
 `. `'`
   `-


Reply to: