dreadnought n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
![](images/avatars/968101440480bc3117f28c.gif)
Joined: 09 Jun 2004 Posts: 21 Location: Linz, Austria
|
Posted: Fri Mar 18, 2005 1:33 pm Post subject: [HOWTO] raidreconf & pvresize with LVM2 |
|
|
I just spent 2 days to expand my 6x160G RAID5 array by 2x160 disks, so I thought I better share my knowledge (no pain, no gain):
First I wasn't really sure about raidreconf, but a quick look at the source code and some reports on successful resize operations eventually convinced me
Code: | raidstop /dev/md0
raidreconf -o /etc/raidtab.old -n /etc/raidtab -m /dev/md0 |
The resizing of the raid array had been successful, but I now had to somehow convince my lvm2 to resize the pv as I used the whole /dev/md0 as a pv and not just some partitions. The command pvresize actually exists, however it just drops out with a
Code: | Command not implemented yet. |
As backing up the whole data and starting again was not an option here is how i managed to resize the pv myself
Code: | pvcreate -ff -u[the uuid of the raid] /dev/md0
vgcreate testing /dev/md0
vgcfgbackup --file raidnewsize testing
vgremove testing
rm /etc/lvm/archive/testing* |
The new volume group I temporarily created uses the correct size of the pv, so the trick is to merge the backup file of the old volume group (in my case /etc/lvm/backup/raid_array) with the backup file of the temporary testing volume group. You just have to replace the following line in the backup file of the old vg
Code: | pe_count = 228940 # 894.296 Gigabytes |
Now restore the modified backup and proceed as if pvresize has ever existed
Code: | vgcfgrestore --file raidnewsize raid_array
lvextend -l 228940 /dev/raid_array/backup
resize2fs /dev/raid_array/backup |
Enjoy. However if things go terribly wrong it's always comforting to have a backup.... ![Rolling Eyes :roll:](images/smiles/icon_rolleyes.gif) |
|