[CLUE-Tech] making use of unused disk space

Mark Horning rip6 at rip6.net
Sun Jul 21 21:33:06 MDT 2002


David Anselmi wrote:

> Jason Friedman wrote:
>
>>                             cfdisk 2.10s
>>
>>                         Disk Drive: /dev/hda
>>                       Size: 20020396032 bytes
>>         Heads: 255   Sectors per Track: 63   Cylinders: 2434
>>
>>    Name      Flags    Part Type FS Type       [Label]      Size (MB)
>>  ------------------------------------------------------------------
>>    hda1      Boot      Primary  Linux ext2    [/boot]          41.13
>>    hda5                Logical  Linux ext2    [/usr]         3150.29
>>    hda6                Logical  Linux ext2    [/home]        3150.29
>>    hda7                Logical  Linux ext2    [/var]         3150.29
>>    hda8                Logical  Linux ext2    [/opt]         3150.29
>>    hda9                Logical  Linux ext2    [/]            3150.29
>>    hda10               Logical  Linux ext2    [/tmp]         1052.84
>>    hda11               Logical  Linux swap                    271.44
>>                        Logical  Free Space                   2903.53
>>
>> Above is the output from cfdisk.
>> It shows I have 2.9GB of free space on my disk.
>> I want to allocate some of that to an existing partition.
>> How do I do that?
>
>
> You have to repartition, and partd can do that non-destructively at 
> least in some cases.
>
> Best may be to backup everything and redo the whole disk.  Quicker may 
> be to just backup/rearrange the partitions you want to grow.  For 
> example, if you wanted to grow hda9 [/] you could swapoff, unmount 
> /tmp, and grow / with partd (preferrably in single-user and 
> read-only).  Maybe partd isn't reliable enough for that (I haven't 
> used it).  In that case, you can at least grow /tmp (because it 
> doesn't have any valuable files on it).
>
> Partitions nearer the front of the disk are more trouble which is why 
> I try to put those likely to fill near the end, when I'm saving space 
> at the end of a disk (like when I have a 40GB drive and only expect 
> ever to use 2-3GB).
>
> Anyway, the better solution in the long run is to use a volume manager 
> like LVM.  Then you can add space from anywhere on any disk to any 
> partition.  I played with it last fall and couldn't grow/shrink a 
> partition (the filesystem has to be adjusted too) reliably.  So I gave 
> up, but the problems may have been fixed by now.
>
> Dave
>
I had similar issues recently and backed up the data, repartitioned and 
started using LVM so I could manage the space 'on the fly' as it were. Up to
this point it's been working pretty well and I haven't run into any data 
corruption issues. I've been able to grow or reduce volumes with or
without the filesystems. It's nice being able to throw a gig or two 
around when needed. The LVM package has a command called e2fsadm that is
a frontend to the LVM commands and a package called ext2resize. The one 
niggle I have seen is that the online (mounted) options have not worked
as expected. Apparently they have a little more work to do with that as 
the device name expected from the LVM commands is different than what
the ext2resize command wants but the offline resizing has worked 
wonderfully. I basically set it up like I would with Veritas in that my root
filesystems are fixed and I won't be using those for the LVM volumes. I 
setup /usr/local, /opt, and other more dynamic filesystems with LVM.

Mark

-- 

Mark Horning
rip6 at rip6.net






More information about the clue-tech mailing list