Skip to main content

Posts

Showing posts from June, 2012

Clone an LVM based KVM based Virtual Machine ;-)

I recently opted to use a volume for my VM (instead of creating a file). RHEVM01 is the "source" and RHUTIL01 is the destination.  I am also cloning from my vg_blackmesa to vg_apps.  One thing I would like to figure out is how to monitor the progress. root@blackmesa ~]# lvdisplay /dev/mapper/vg_blackmesa-VM_RHEVM01   --- Logical volume ---   LV Path                /dev/vg_blackmesa/VM_RHEVM01   LV Name                VM_RHEVM01   VG Name                vg_blackmesa   LV UUID                zx4BLV-Athf-Ymcd-ox4h-965J-uo30-Aey9dJ   LV Write Access        read/write   LV Creation host, time blackmesa.area51.private, 2012-06-22 00:12:02 -0500   LV Status              available   # open                 1   LV Size                20.00 GiB   Current LE             5120   Segments               1   Allocation             inherit   Read ahead sectors     auto   - currently set to     256   Block device           253:6 [root@blackmesa ~]# vgs   VG           #P

display the line number in a file (vi / vim)

When writing scripts,I often like to insert text into a file at a very specific location/line. The following lines of code, will enable rsync comment out the line starting with default_password_crypted insert a new line with  default_password_crypted in it's place [root@rhnsat01 ~]# sed -i -e 's/\=\ yes/\=\ no/g' /etc/xinetd.d/rsync [root@rhnsat01 ~]# sed -i -e 's/default_password_crypted:/#default_password_crypted:/g' /etc/cobbler/settings [root@rhnsat01 ~]# MYPASS=`openssl passwd -1 -salt 'Passw0rd' 'Passw0rd'` [root@rhnsat01 ~]# sed -i -e '84i'${MYPASS}'' /etc/cobbler/settings  In vi, to see the line you are on (I don't know how to turn the numbers back off though ;-) : set number