[CALUG] repartitioning on the fly

Dave Dodge dododge at dododge.net
Sat Nov 5 21:55:27 CST 2005

On Sat, Nov 05, 2005 at 01:05:09PM -0800, David Salinas wrote:
> By the way, I've never found away to rebuild a servers file system when
> one of those partitions were part of swap. Not even sure that LVM can
> do that.

You can turn swap space on and off on the fly with the "swapon"

If the machine is too stressed to run without swap, then just find
space somewhere else (a file, extra disk, whatever) and temporarily
add that to the swap set.  Then once you disable a swap partition, you
can do whatever you want to it.  If you resize it or move it, it's
best to just run "mskwap" again to reformat it; there's no need to
waste time trying to preserve/copy the data.

> Use hardware RAID if you can. And LVM so you can re-size your
> partitions later if you need to

LVM definitely makes this easier; I've used it on pretty much every
system I've built in the last 3-5 years.  If I need space for
something, I just "lvcreate" a new block device, build a filesystem,
and mount it somewhere.  If I later find that I need more space in
that filesystem, I can "lvextend" and "resize2fs" (or equivalent) to
make it larger.  The filesystem itself has to be unmounted while being
resized, but otherwise this can all be done on the fly and no
rebooting is required.

> (not swap!).

You can swap to a logical volume.  I'm not sure if this is guaranteed
deadlock-free in 2.4 once it gets near full, but I've never personally
seen it break.  I think in 2.6 it's considered officially reliable to
swap to lvm.

                                                  -Dave Dodge

More information about the lug mailing list