moving lv from local VG to a remote VG
Sorry if it's OT, but we have a debian lenny with a big VG1 a some LVs inside and want to move all LV's from VG1 to another VG2 located in other server. Is it possible? I've searched the web with no success. thanks. -- Regards; Israel Garcia -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Re: moving lv from local VG to a remote VG
On Fri, Oct 30, 2009 at 6:01 AM, Israel Garcia wrote: > Sorry if it's OT, but we have a debian lenny with a big VG1 a some LVs > inside and want to move all LV's from VG1 to another VG2 located in > other server. Is it possible? - Create LV in VG2 with the same size from LVs in VG1 - cat /dev/VG1/lv1 | ssh server2 "cat > /dev/VG2/lv1" If you want to know thoughput use pv and not cat Of course you can script it to do it in a for bucle ... with awk help :) ... Regards, -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Re: moving lv from local VG to a remote VG
Le Friday 30 October 2009 06:01:21 Israel Garcia, vous avez écrit : > Sorry if it's OT, but we have a debian lenny with a big VG1 a some LVs > inside and want to move all LV's from VG1 to another VG2 located in > other server. Is it possible? > > I've searched the web with no success. > > thanks. You also have the option to go through a big external disk : 1) plug the external disk in your server 1 2) add the disque to VG1 - pvcreate /dev/sdXY (the external drive, or a partition on the external drive) - vgextend VG1 /dev/sdXY 3) move the data to the external disk with pvmove (2 solutions) - pvmove -n LV1 /dev/sdXY for each LV or - pvmove /dev/sdAB /dev/sdXY for each PV in VG1 (if there is only one, it's just one command comparing to solution 1) 4) deactivate VG1 on server 1 - vgchange -a n VG1 (you can delete it after, I don't think it's wise to delete it now) 5) unplug the external drive, and plug it to server 2 6) add the PV on the external drive to VG2 on server 2 - vgextend VG2 /dev/sdXY (perhaps a pvscan will be needed ?) 7) Move the data to the disks of VG2 - pvmove /dev/sdXY (no destination needed, except if you really want where to put the data) 8) remove the PV of external drive - vgreduce VG2 /dev/sdXY 9) you're done ! Unplug the external drive. signature.asc Description: This is a digitally signed message part.
Re: moving lv from local VG to a remote VG
On Fri, Oct 30, 2009 at 10:24:57AM +0100, Javier Barroso wrote: > On Fri, Oct 30, 2009 at 6:01 AM, Israel Garcia wrote: > > Sorry if it's OT, but we have a debian lenny with a big VG1 a some LVs > > inside and want to move all LV's from VG1 to another VG2 located in > > other server. Is it possible? > > - Create LV in VG2 with the same size from LVs in VG1 > - cat /dev/VG1/lv1 | ssh server2 "cat > /dev/VG2/lv1" also, never underestimate the bandwidth of a stationwagon full of {magnetic tape | harddrives | thumbdrives}. In other words, if the amount of data is significant enough, the best solution can be to physically move the data instead of trying to shove it through a skinny pipe (skinniness of said pipe being inversely proportional to the amount of data). A signature.asc Description: Digital signature
Re: moving lv from local VG to a remote VG
On Fri, Oct 30, 2009 at 07:54:22PM +0100, Gilles Mocellin wrote: > Le Friday 30 October 2009 06:01:21 Israel Garcia, vous avez écrit : > > Sorry if it's OT, but we have a debian lenny with a big VG1 a some LVs > > inside and want to move all LV's from VG1 to another VG2 located in > > other server. Is it possible? > > > > I've searched the web with no success. > > > > thanks. > > You also have the option to go through a big external disk : > 1) plug the external disk in your server 1 > > 2) add the disque to VG1 > - pvcreate /dev/sdXY (the external drive, or a partition on the external > drive) > - vgextend VG1 /dev/sdXY > > 3) move the data to the external disk with pvmove (2 solutions) > - pvmove -n LV1 /dev/sdXY for each LV or > - pvmove /dev/sdAB /dev/sdXY for each PV in VG1 (if there is only one, > it's just one command comparing to solution 1) aren't you missing a step to that the pv out of the vggroup ? > > 4) deactivate VG1 on server 1 > - vgchange -a n VG1 (you can delete it after, I don't think it's wise to > delete it now) > > 5) unplug the external drive, and plug it to server 2 > > 6) add the PV on the external drive to VG2 on server 2 > - vgextend VG2 /dev/sdXY (perhaps a pvscan will be needed ?) > > 7) Move the data to the disks of VG2 > - pvmove /dev/sdXY (no destination needed, except if you really want > where > to put the data) > > 8) remove the PV of external drive > - vgreduce VG2 /dev/sdXY > > 9) you're done ! Unplug the external drive. -- "See, the irony is that what they need to do is get Syria to get Hezbollah to stop doing this shit, and it's over." - George W. Bush 06/16/2006 St. Petersburg, Russia to Tony Blair at the G8 summit signature.asc Description: Digital signature
Re: moving lv from local VG to a remote VG
Israel Garcia writes: > Sorry if it's OT, but we have a debian lenny with a big VG1 a some LVs > inside and want to move all LV's from VG1 to another VG2 located in > other server. Is it possible? > > I've searched the web with no success. It looks like you could just use pvmove to move the data. I haven't tried this, so you will have to look at the other lvm commands to see if any other steps are required. -- Carl Johnsonca...@peak.org -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Re: moving lv from local VG to a remote VG
On Sat, Oct 31, 2009 at 07:12:10AM +1100, Alex Samad wrote: [...] > > 3) move the data to the external disk with pvmove (2 solutions) > > - pvmove -n LV1 /dev/sdXY for each LV or > > - pvmove /dev/sdAB /dev/sdXY for each PV in VG1 (if there is only one, > > it's just one command comparing to solution 1) > > aren't you missing a step to that the pv out of the vggroup ? Yes, it's possible. - vgreduce VG1 /dev/sdXY But, if he deletes VG1 after, it's not necessary to remove the PV. > > 4) deactivate VG1 on server 1 > > - vgchange -a n VG1 (you can delete it after, I don't think it's wise > > to > > delete it now) [...] Unless you speak about the PV on the external disk. Here, I must admit that I don't know if the data will be still there if we do a vgreduce of the PV containing it. I will do a test, as I want to know if what I said is possible ! Soon here. signature.asc Description: Digital signature
Re: moving lv from local VG to a remote VG
On Sat, Oct 31, 2009 at 10:57:33AM +0100, Gilles Mocellin wrote: > On Sat, Oct 31, 2009 at 07:12:10AM +1100, Alex Samad wrote: > > [...] > > > > 3) move the data to the external disk with pvmove (2 solutions) > > > - pvmove -n LV1 /dev/sdXY for each LV or > > > - pvmove /dev/sdAB /dev/sdXY for each PV in VG1 (if there is only > > > one, > > > it's just one command comparing to solution 1) > > > > aren't you missing a step to that the pv out of the vggroup ? > > Yes, it's possible. > - vgreduce VG1 /dev/sdXY > > But, if he deletes VG1 after, it's not necessary to remove the PV. > > > > 4) deactivate VG1 on server 1 > > > - vgchange -a n VG1 (you can delete it after, I don't think it's > > > wise to > > > delete it now) > > [...] > > Unless you speak about the PV on the external disk. > Here, I must admit that I don't know if the data will be still there if > we do a vgreduce of the PV containing it. > > I will do a test, as I want to know if what I said is possible ! > Soon here. Well, it's not so easy. Adding a PV with data to a VG does not bring the metadata and does not make the LVs visible. I manage to transfert LV via pvmove this way : 1) vgsplit to isolate the LVs to move in a separate VG (VGTEMP). If you want to move all the LVs, no need to vgsplit. 2) Add a new PV to VGTEMP from an external drive (Here, I've just think you can use a network exported block device, like nbd, iscsi, aoe) 3) pvmove from local PV to the external one 4) vgexport VGTEMP 5) move the external drive (or unexport/reexport the network block device) 6) pvscan eventually and vgimport VGTEMP 7) vgmerge VG2 VGTEMP 6) pvmove from external drive to local drives 7) vgreduce VG2 to remove external drive I don't really think that this method is faster than a raw copy of the LV block devices... signature.asc Description: Digital signature