View previous topic :: View next topic |
Author |
Message |
slithy Guru
Joined: 26 Nov 2005 Posts: 321 Location: Kansas
|
Posted: Thu Jun 07, 2007 1:43 am Post subject: LVM and XFS [Solved] |
|
|
So I am thinking about setting up LVM with the following disks, a 500GB (yet to buy), a 320GB, and a 250GB. The setup would consist of one logical volume across all three disks. I want to use XFS for the filesystem since I will be storing media on it and I want the advantages that XFS provides in regard to large files.
My question is that since you can't shrink with XFS, will it be possible to swap out one of the smaller disks for a larger one without copying the entire contents of the logical volume and making the file system over again. I'm not really sure how exactly one swaps a disk out in an logical volume. Do you add the bigger one, grow the logical volume and FS, then copy the data from the drive you want to remove, followed by shrinking the fs down?
Last edited by slithy on Mon Jun 11, 2007 10:26 pm; edited 1 time in total |
|
Back to top |
|
|
vaxbrat l33t
Joined: 05 Oct 2005 Posts: 731 Location: DC Burbs
|
Posted: Thu Jun 07, 2007 3:44 am Post subject: If you want to be daring |
|
|
I've never tried this but I suspect you could pop in a larger drive with the xfs filesystem unmounted, do a 'dd' to clone the smaller drive to the new larger one and then pull the old drive out while re-arranging things to make the new drive take the same device node as the old.
The new drive will have empty space at the end after the dd cloning, so you could create yet another partition there and then maybe cajole lvm and xfs to add it to expand the volume. |
|
Back to top |
|
|
fikiz Apprentice
Joined: 07 Mar 2005 Posts: 282 Location: Italy
|
Posted: Thu Jun 07, 2007 1:27 pm Post subject: |
|
|
You can add the new disk, add it to the volume group, tell LVM to stop using the small disk (with pvmove command, it will copy all the extents on the disk to be removed to the new disk, and with vgreduce) and then you can remove the small disk. You can do this without unmounting the xfs filesystem (the filesystem doesn't realize what LVM is doing). The only thing that stops the access to the filesystem is the shutdown needed to connect/disconnect the harddisk.
ciao |
|
Back to top |
|
|
slithy Guru
Joined: 26 Nov 2005 Posts: 321 Location: Kansas
|
Posted: Thu Jun 07, 2007 3:33 pm Post subject: |
|
|
Sounds good, of course after doing the pvmove, I would want to grow the FS to include the additional space on the new drive, correct?
I'm doing quite a bit of planning before I actually assemble this because I don't want to be stuck down the road with about 1TB of data to have to copy someplace in order to add/remove drives, which doesn't look that will be the case with xfs on LVM. |
|
Back to top |
|
|
fikiz Apprentice
Joined: 07 Mar 2005 Posts: 282 Location: Italy
|
Posted: Fri Jun 08, 2007 1:53 pm Post subject: |
|
|
pvmove doesn't add the additional space to the logical volume containing your xfs filesystem. It merely moves the extents placed on the disk that you want remove to unallocated areas on other disks belonging to the same volume group.
after adding the new disk to the volume group (vgextend command), moving extents (pvmove) and removing the old disk (vgreduce command) you should have free physical extents in your volume group (just because the new disk is bigger then the old one). the command vgdisplay shows the free extents available.
If you have free physical extents, you can extend the logical volume of the xfs filesystem (lvextend command). after this, you can use xfs_growfs command to finally give the filesystem the new available space. |
|
Back to top |
|
|
|