partition question

Bryn M. Reeves bmr at redhat.com
Mon May 28 09:43:27 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/27/2012 09:04 PM, Geoffrey Leach wrote:
> On 05/27/2012 12:45:45 PM, Phil Dobbin wrote: I went around that
> tree a few months back, and as far as I could discover there is no
> was to resize a partition. The parted documentation seemed to imply
> that resizing was supported, but at the end, no luck.
> 

It's possible but there are a fair number of steps involved.

Use rescue mode (you'll need to in order to resize the rootfs and
partition containing the PV).

Boot into rescue mode and skip the file system detection option then
use lvresize or lvreduce to shrink the file system volumes and their
file systems (specify the --resizefs flag - otherwise you need to do
this as a two-step process, first shrink the file system with e.g.
resize2fs, then shrink the LV that contains it).

Once you've shrunk the LVs you can check to see if the PV can be
resized - use pvresize with the --setphysicalvolumesize option to set
the the PV to the intended size.

If this step fails it will be because there are still extents
allocated to some LVs that are using the space you want to free up
(this is unlikely with the default Fedora layout but can happen with
more complex VGs or VGs that have a lot of allocations taking place).
If this is the case you'll need to use pvmove to relocate those
extents elsewhere (see the pvmove man page).

Once the PV has been reduced in size you can shrink the partition.
Unfortunately there's no good automatic support for this today. Parted
still insists on resizing file systems (but doesn't work with most
common file systems..).

I normally use fdisk: you'll need to remove (delete) the partition you
want to resize and then re-create it with the same starting offset.
The easiest way to do this is to use sector mode (default now) and
make a note of the value in the start column before removing the original.

If you're using a GPT partition table then you can do the same
remove/re-add routine with parted but I prefer fdisk for MBR partition
tables (again, use sector units when modifying the partition).

Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/DSL8ACgkQ6YSQoMYUY96NJACaAtX4udNORzZiKf71tF/36zCB
QbsAnRcGwTKEhBC99oRcWrt32GDjTBjZ
=mC1T
-----END PGP SIGNATURE-----


More information about the users mailing list