I've finally finished all the upgrades on the Slackware system. Here's
how it played out:
- Create new partition, tag it 0x8e (LVM). cfdisk does this nicely.
- 'pvcreate' the new partition (to initialize the LVM).
- 'vgextend' the volume group with the new partition (this adds lots
of free extents to the group).
- 'pvmove' the old device (which made lvm migrate all the data extents
to the newly added extents: this took 17 hours! It might go faster if
you use eSATA instead of an external USB drive).
- 'vgreduce' the old device from the volume group.
- 'lvextend' the existing volume group by the remaining free extents
in a vgdisplay command (since my new drive was larger than my old drive,
I had leftover free extents once the data was moved). You can use
"lvextend -l+2345 logical_volume".
- Finally, grow the file system using the apropos tool. For xfs, this
is xfs_growfs. It defaults to enlarging the partition to fill the free
space. It also only grows the partition while it's mounted, so it's
another operation the system did not have to be unavailable for. This
step takes almost no time at all (the only really long one is the
'pvmove' step).
A complete migration of 342gb of data and a grow in the partition with 0
downtime! I like it :D
Note: resizing filesystems like ext3 are a bit trickier, since you have
to umount it, re-partition manually, and then run resize... there's an
online mount patch, but I don't think it's in the kernel. reiser and
jfs also support online risizing; I just happen to use XFS because it
handles multi-gb files very well.
Here's how easily the grow step went for me:
# df
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.6G 3.9G 3.4G 54% /
/dev/sda6 140G 2.6G 138G 2% /tmp_mnt
/dev/mapper/media-medialv
373G 342G 31G 92% /media
# xfs_growfs /media
meta-data=/media isize=256 agcount=16, agsize=6104768
blks
= sectsz=512
data = bsize=4096 blocks=97676288, imaxpct=25
= sunit=0 swidth=0 blks, unwritten=1
naming =version 2 bsize=4096
log =internal bsize=4096 blocks=32768, version=1
= sectsz=512 sunit=0 blks
realtime =none extsz=65536 blocks=0, rtextents=0
data blocks changed from 97676288 to 122095616
# df
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 7.6G 3.9G 3.4G 54% /
/dev/sda6 140G 2.6G 138G 2% /tmp_mnt
/dev/mapper/media-medialv
466G 342G 124G 74% /media
LVM2 is very awesome, and (if you're using a kernel like 2.6.19 and
recent tools) is able to toss around large chunks of data with no
hiccups I could find.
Received on Wed Mar 14 14:58:36 2007
This archive was generated by hypermail 2.1.8 : Wed Mar 14 2007 - 14:58:44 CST