Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Resizing the /boot partition

0 views
Skip to first unread message

Mark Hobley

unread,
Sep 7, 2008, 8:51:32 AM9/7/08
to
I want to resize the /boot partition on a remote machine. I have managed
to free up some disk space immediately following the partition as
follows:

/dev/hda1 1 62 31216+ 83 Linux

.... free space here ....

/dev/hda4 525 238216 119796768 5 Extended

I now want to extend the /boot partition so that it ends at cylinder
number 524.

Using fdisk, if I were to delete the partition, and recreate it at the
right size, I would require a reboot in order to use the new partition
table before restoring the data. Unfortunately, because this is /boot, I
cannot do that, because the partition would be needed before the restore
takes place.

I need some way to resize the partition and making it useable without
rebooting, so that I can run lilo against the resized partition prior to
rebooting.

I have only telnet access to this machine, and it has no graphical user
interface, so I cannot run any tools that require the X windows system.

Any suggestions?

Mark.

--
Mark Hobley,
393 Quinton Road West,
Quinton, BIRMINGHAM.
B32 1QE.

Grant

unread,
Sep 7, 2008, 9:55:23 AM9/7/08
to

create a /dev/hda2 wit hthe space in between, copy /boot to /dev/hda2 and
use that on the next boot, forget the /dev/hda1 space. You need to reboot
before formatting the new partition anyway.

Grant.
--
Cats, no less liquid than their shadows, offer no angles to the wind.

Dances With Crows

unread,
Sep 7, 2008, 10:44:33 AM9/7/08
to
Mark Hobley staggered into the Black Sun and said:
> I want to resize the /boot partition on a remote machine.
>
> /dev/hda1 1 62 31216+ 83 Linux
> /dev/hda4 525 238216 119796768 5 Extended
>
> I now want to extend the /boot partition so that it ends at cylinder
> 524.
>
> Using fdisk, if I were to delete the partition, and recreate it at the
> right size, I would require a reboot

Yeah, that's what happens when you modify the partition table on the
disk that contains / . No way around that currently, unless you have /
on an LV. Why do you need so much space on /boot, anyway? I've got 3
kernels and 1 initrd on mine, and that's only taking up 11M.

> in order to use the new partition table before restoring the data.

"Restoring the data"? Huh? Just resize2fs the thing after the
partition table's changed. Changing the size of the partition won't do
anything to the filesystem that's currently there.

> I need some way to resize the partition and making it useable without
> rebooting, so that I can run lilo against the resized partition prior
> to rebooting.

No, you don't need to do this. Just resize the partition, reboot, then
resize the filesystem. You may need to run LILO again after you've
resized the filesystem, but it would surprise me if resize2fs actually
moved files to different absolute sectors when it was expanding a
filesystem.

--
Technology makes it possible for people to gain control over
everything, except over technology. --John Tudor
My blog: http://crow202.org/wordpress/
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see

Robert Heller

unread,
Sep 7, 2008, 11:08:23 AM9/7/08
to
At Sun, 7 Sep 2008 13:51:32 +0100 markh...@hotpop.donottypethisbit.com (Mark Hobley) wrote:

>
> I want to resize the /boot partition on a remote machine. I have managed
> to free up some disk space immediately following the partition as
> follows:
>
> /dev/hda1 1 62 31216+ 83 Linux
>
> .... free space here ....
>
> /dev/hda4 525 238216 119796768 5 Extended
>
> I now want to extend the /boot partition so that it ends at cylinder
> number 524.
>
> Using fdisk, if I were to delete the partition, and recreate it at the
> right size, I would require a reboot in order to use the new partition
> table before restoring the data. Unfortunately, because this is /boot, I
> cannot do that, because the partition would be needed before the restore
> takes place.

Resizing a partition with fdisk does not change the file system there.

What you do is this:

1) use fdisk to 'delete' and recreate the partition. Fdisk only
modifies the partition table - IT DOES NOT ALTER THE PARTITION ITSELF.
In other words, fdisk does not 'delete' the *contents* of the
partition, it only deletes the entry in the partition table. Be *real*
careful about the staring cylinder when you create the new (replacement)
partition table entry -- this is critical.

2) reboot (note: lilo does not use the partition table -- it's hard disk
addresses are stored in it's boot map -- fdisk does not change this
information or what the addresses map to). /boot should be the same
size as always.

3) umount /boot -- I believe you should be able to do this at this
point (yes, I just verified this on my machine).

4) run /sbin/e2fsck -f /dev/hda1 (just to be totally sure the fs is
clean).

5) run /sbin/resize2fs /dev/hda1 (This will 'grow' the fs to fill the
available space).

6) run /sbin/e2fsck -f /dev/hda1 (just to be totally sure the fs is
clean).

7) mount /boot.

8) re-run lilo -- this will update lilo's boot map.

>
> I need some way to resize the partition and making it useable without
> rebooting, so that I can run lilo against the resized partition prior to
> rebooting.
>
> I have only telnet access to this machine, and it has no graphical user
> interface, so I cannot run any tools that require the X windows system.
>
> Any suggestions?
>
> Mark.
>

--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
hel...@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk

Dances With Crows

unread,
Sep 7, 2008, 11:52:29 AM9/7/08
to
Robert Heller staggered into the Black Sun and said:
> At Sun, 7 Sep 2008 13:51:32 +0100
> markh...@hotpop.donottypethisbit.com (Mark Hobley) wrote:
>> I want to resize the /boot partition on a remote machine. I have
[snip]

> 3) umount /boot -- I believe you should be able to do this at this
> point (yes, I just verified this on my machine).

Not necessary. Linux has supported making ext23 filesystems larger
while they're mounted for a year or 2 now. You still have to umount to
shrink a filesystem, though.

--
"Cheer up, things could be worse." So I cheered up, and sure enough,
things got worse.

Mark Hobley

unread,
Sep 7, 2008, 3:53:36 PM9/7/08
to
Robert Heller <hel...@deepsoft.com> wrote:
>
> 1) use fdisk to 'delete' and recreate the partition.

> 2) reboot

> 3) umount /boot

> 4) run /sbin/e2fsck -f /dev/hda1

> 5) run /sbin/resize2fs /dev/hda1

> 6) run /sbin/e2fsck -f /dev/hda1

> 7) mount /boot.

> 8) re-run lilo -- this will update lilo's boot map.

Ok. Cheers Robert! That worked just fine.

0 new messages