Mailing List Archive

Resizing partitions - was df says one thing, du another
Rudmer van Dijk wrote:
> On Tue, October 19, 2004 8:14, Andrew Lowe said:
>
>>Greetings people,
>> I've got a small machine that is a bit limited on disk space that I'm
>>using as a firewall thingy. I've gone to update it, "emerge --sync" and
>>get an rsync error about the partition being full. I ran df and it said
>>the partition, /usr, was full. I emptied out a few dir's and then redid
>>"df" on the disk and it says that the /usr partition has a size of 788M,
>>is using 560M and has 188M free, 75% used. I then run "du -h
>>--max-depth=2" on /usr and it says that there are 371M of files. Why is
>>there the difference between the two commands?
>
>
> df displays the actual disksize in use
> du displays the total filesize
>
> total filesize != disksize in use
> because a file of say 10 bytes will use a whole block of blocksize (eg.
> 4kB) on disk (except when you use reiserfs)
>
>
> Rudmer

So if I want to reorganise my disk to give the /usr partition a bit
more space, I should:

1) Boot off the Gentoo CD

2) Mount my small disk

3) Move the contents of the current /usr and the "donor" partition
somewhere safe

4) Blow away the existing /usr and donor with an fdisk type of thing

5) Recreate /usr and donor with new sizes

6) Copy the stuff from 2) back into place

7) Reboot

Or is there a freebie thing like Partition Magic that would make this
easier?

Having not looked at this machine for nearly two years, I see that I
have /usr on a partition of about 800M and /usr/local & /usr/scr sharing
a partition of about 1500M. For the life of me I can't remember why I've
done this. Should I just place all of the /usr stuff, /usr, /usr/share
and /usr/scr, back under the one resized 2.3G partition?

Any thoughts greatly appreciated

Andrew

--
gentoo-user@gentoo.org mailing list
Re: Resizing partitions - was df says one thing, du another [ In reply to ]
Andrew Lowe wrote:
> Rudmer van Dijk wrote:
>> On Tue, October 19, 2004 8:14, Andrew Lowe said:
>>
>>>Greetings people,
>>> I've got a small machine that is a bit limited on disk space that I'm
>>>using as a firewall thingy. I've gone to update it, "emerge --sync" and
>>>get an rsync error about the partition being full. I ran df and it said
>>>the partition, /usr, was full. I emptied out a few dir's and then redid
>>>"df" on the disk and it says that the /usr partition has a size of 788M,
>>>is using 560M and has 188M free, 75% used. I then run "du -h
>>>--max-depth=2" on /usr and it says that there are 371M of files. Why is
>>>there the difference between the two commands?
>>
>>
>> df displays the actual disksize in use
>> du displays the total filesize
>>
>> total filesize != disksize in use
>> because a file of say 10 bytes will use a whole block of blocksize (eg.
>> 4kB) on disk (except when you use reiserfs)
>>
>>
>> Rudmer
>
> So if I want to reorganise my disk to give the /usr partition a bit
> more space, I should:
>
> 1) Boot off the Gentoo CD
>
> 2) Mount my small disk
>
> 3) Move the contents of the current /usr and the "donor" partition
> somewhere safe
>
> 4) Blow away the existing /usr and donor with an fdisk type of thing
>
> 5) Recreate /usr and donor with new sizes
>
> 6) Copy the stuff from 2) back into place
>
> 7) Reboot
>
> Or is there a freebie thing like Partition Magic that would make this
> easier?

Yes, it would've been easier, if you would have created/used LVM
partitions. They allow you to VERY easily extend volumes ("partitions").

But, given that you used the old, hard way, your options are
either like you wrote above. If you've got free, unpartitioned space
*after* the /usr partition, you don't have to throw away your /usr
fs. With fdisk, you could delete the /usr partition and create
a new one, that starts at the exact same spot and ends some place
later. This *will* keep your filesystem intact! (But a backup is
always a good idea *G*) After you've increased the size of the
partition, you can "grow" the filesystem. How to do that, depends
on the fs you've choosen. The LVM howto is quite helpful:

http://www.tldp.org/HOWTO/LVM-HOWTO/extendlv.html

Alexander Skwar
--
panic("aha1740.c"); /* Goodbye */
2.2.16 /usr/src/linux/drivers/scsi/aha1740.c
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


--
gentoo-user@gentoo.org mailing list
Re: Re: Resizing partitions - was df says one thing, du another [ In reply to ]
Alexander W. Skwar wrote:
> Andrew Lowe wrote:
>
>>Rudmer van Dijk wrote:
>>
>>>On Tue, October 19, 2004 8:14, Andrew Lowe said:
>>>
>>>
>>
[SNIP]
...
...
[SNIP]
> Yes, it would've been easier, if you would have created/used LVM
> partitions. They allow you to VERY easily extend volumes ("partitions").
>
> But, given that you used the old, hard way, your options are
> either like you wrote above. If you've got free, unpartitioned space
> *after* the /usr partition, you don't have to throw away your /usr
> fs. With fdisk, you could delete the /usr partition and create
> a new one, that starts at the exact same spot and ends some place
> later. This *will* keep your filesystem intact! (But a backup is
> always a good idea *G*) After you've increased the size of the
> partition, you can "grow" the filesystem. How to do that, depends
> on the fs you've choosen. The LVM howto is quite helpful:
>
> http://www.tldp.org/HOWTO/LVM-HOWTO/extendlv.html
>
> Alexander Skwar

Thanks for that. I thought what I wrote was the way to go, I just
needed someone to confirm it.

Regards,
Andrew Lowe

--
gentoo-user@gentoo.org mailing list
Re: Resizing partitions - was df says one thing, du another [ In reply to ]
Andrew Lowe wrote:

> Thanks for that. I thought what I wrote was the way to go, I just
> needed someone to confirm it.

No, not quite. Strictly speaking, steps 3 and 6 are not necessary.
But it's for sure a good idea to have a backup (step 3), but
you wont need to do step 6.

Alexander Skwar
--
panic("aha1740.c"); /* Goodbye */
2.2.16 /usr/src/linux/drivers/scsi/aha1740.c
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯


--
gentoo-user@gentoo.org mailing list
Re: Re: Resizing partitions - was df says one thing, du another [ In reply to ]
Alexander W. Skwar wrote:
> Andrew Lowe wrote:
>
>>>On Tue, October 19, 2004 8:14, Andrew Lowe said:
>>
>> So if I want to reorganise my disk to give the /usr partition a bit
>>more space, I should:
>>
<snip>
>>
>> Or is there a freebie thing like Partition Magic that would make this
>>easier?
>
>
> Yes, it would've been easier, if you would have created/used LVM
> partitions. They allow you to VERY easily extend volumes ("partitions").

Indeed they do. I switched to LVM(2) because I was *sooooo* tired of
repartitioning, and I am still stunned that I can increase a partition's
size in *one minute, with TWO commands*. It was not exactly easy to set
up (because I reinstalled the system from a Knoppix disk, using the
Alternative Install Guide, and it's a little convoluted to install the
LVM components and modules under Knoppix-- but quite doable; would have
been a snap had I used the Gentoo Live CD), but it was more than totally
worth it.

>
> But, given that you used the old, hard way, your options are
> either like you wrote above.

Give the poor guy a break. Where have you seen an install guide (for any
distro) that even mentions LVM, much less suggests it?

I didn't know it existed for over a year, and I had spent that year
distro-hopping, so it definitely would have been useful for me to know
about.

I think the theory is that if regular partitioning is one of the most
terrifying install tasks a new/inexperienced user faces (which it is
generally considered to be), then introducing something 'arcane' like
LVM, with its "incomprehensible" (and further terrifying) list of
commands is just beyond the pale.

I don't agree, given that the benefits are more than worth it, but that
seems to be the current way of thinking.

> If you've got free, unpartitioned space
> *after* the /usr partition, you don't have to throw away your /usr
> fs. With fdisk, you could delete the /usr partition and create
> a new one, that starts at the exact same spot and ends some place
> later. This *will* keep your filesystem intact! (But a backup is
> always a good idea *G*) After you've increased the size of the
> partition, you can "grow" the filesystem. How to do that, depends
> on the fs you've choosen. The LVM howto is quite helpful:
>
> http://www.tldp.org/HOWTO/LVM-HOWTO/extendlv.html

Yes, that's the link I use also.

Here's another good one for a quick reference of the various commands
available to LVM systems:

http://www.die.net/doc/linux/man/man8/lvm.8.html

See the bottom for the "See Also" listing, or use man lvm once installed.

Holly

>
> Alexander Skwar


--
gentoo-user@gentoo.org mailing list
Re: Re: Resizing partitions - was df says one thing, du another [ In reply to ]
checkout lvmgui (http://www.xs4all.nl/~mmj/lvm/) it is great Not
maintained anymore but as the invocations are not changed I still use it

Ron

--
In remembrance -- http://www.ronsmits.org


--
gentoo-user@gentoo.org mailing list
Re: Re: Resizing partitions - was df says one thing, du another [ In reply to ]
On Tue, Oct 19, 2004 at 02:10:21PM +0200, Holly Bostick wrote:
> size in *one minute, with TWO commands*. It was not exactly easy to set
> up (because I reinstalled the system from a Knoppix disk, using the
> Alternative Install Guide, and it's a little convoluted to install the
> LVM components and modules under Knoppix-- but quite doable; would have
> been a snap had I used the Gentoo Live CD), but it was more than totally
> worth it.
The docs are still less than fully helpful if you want an
all-LVM-except-/boot system (which is what you'd need for maximal
flexibility...and of course, flexibility is the most compelling reason to
use LVM at all...).

I've thought of writing up my experience and submitting it as
another alternative installation guide. I seriously think LVM would help a
lot of people, since other than blindly following the guide's advice (which
is sometimes a bad idea, depending on the outcome you want) it's really
profoundly hard to get partition sizes right the first time, and downright
painful to change them later unless you're using LVM.
>
> I think the theory is that if regular partitioning is one of the most
> terrifying install tasks a new/inexperienced user faces (which it is
> generally considered to be), then introducing something 'arcane' like
> LVM, with its "incomprehensible" (and further terrifying) list of
> commands is just beyond the pale.
FWIW, I found the /dev-management (and manual initrd-creation)
situation to be a lot harder than the commands. :)

But in reality, if you're a newbie, I really don't think it _is_
more complicated...it's just _differently_ complicated. And the reassurance
that "this will make it easier to fix things later if you make a mistake
right now" ought to help a lot.
--
Matthew Landry mbl@lelnet.com O-
LEL Network Services Anti-Stupid Talisman
"You don't have to outrun the bear. Just outrun the slowest hiker."
GPG Fingerprint: 842E B9FC BA37 3C4F BBFA 91A8 CA08 40FB 8561 71A7

--
gentoo-user@gentoo.org mailing list
Re: Re: Resizing partitions - was df says one thing, du another [ In reply to ]
* On Tue Oct-19-2004 at 02:10:21 PM +0200, Holly Bostick said:
> Alexander W. Skwar wrote:
> >
> >But, given that you used the old, hard way, your options are
> >either like you wrote above.
>
> Give the poor guy a break. Where have you seen an install guide (for any
> distro) that even mentions LVM, much less suggests it?

I don't think Alexander was trying to give him a hard time; he did,
after all, help him out.

Anyways, there is an LVM guide available... and in the green and
purply comfort of the Gentoo site to boot.

http://www.gentoo.org/doc/en/lvm2.xml

Googling for "gentoo <blah>" in order to find something on the Gentoo
website has worked well for me on many occasions.

--
Sami Samhuri