r2 - 22 Oct 2009 - 23:20:37 - DouglasBenjaminYou are here: TWiki >  AtlasSoftware Web > Virtualt3Tipsandtricks

Virtualt3Tipsandtricks - Notes on work done at the BNL Tier 3

allowing X windows to be open from with sudo command

  • In order to allow sudo virt-manager to open a window - need to define environmental variable XAUTHORITY


export XAUTHORITY=~benjamin/.Xauthority

Adding disk space to an existing virtual machine

  • Use dd to create a file to be used as disk space for a virtual machine
dd if=/dev/zero of=/var/lib/xen/images/diskimage_100GB.img oflag=direct bs=1M count=100K

  • Create ext3 file system

/sbin/mkfs.ext3 -b 4096 -O dir_index /var/lib/xen/images/diskimage_100GB.img
mke2fs 1.39 (29-May-2006)
/var/lib/xen/images/diskimage_100GB.img is not a block special device.
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
13107200 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
800 block groups
32768 blocks per group, 32768 fragments per group
16384 inodes per group
Superblock backups stored on blocks: 
   32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
   4096000, 7962624, 11239424, 20480000, 23887872

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

  • Modify VM configuration file that you want to use add disk

disk = [ "tap:aio:/var/lib/xen/images/sl53-x86_64_v2_srm.img,xvda,w",
         "tap:aio:/var/lib/xen/images/diskimage_100GB.img,xvdb,w" ]

  • Startup VM

Inside of VM :

* First create a physical volume using pvcreate

[root@atlast3vm9 ~]# pvcreate /dev/xvdb
  Physical volume "/dev/xvdb" successfully created
[root@atlast3vm9 ~]# pvscan
  PV /dev/xvda2   VG VolGroup00      lvm2 [19.41 GB / 0    free]
  PV /dev/xvdb                       lvm2 [100.00 GB]
  Total: 2 [119.41 GB] / in use: 1 [19.41 GB] / in no VG: 1 [100.00 GB]

  • Now a Volume group

[root@atlast3vm9 ~]# vgcreate VolGrpSRM /dev/xvdb
  Volume group "VolGrpSRM" successfully created
[root@atlast3vm9 ~]# vgscan
  Reading all physical volumes.  This may take a while...
  Found volume group "VolGrpSRM" using metadata type lvm2
  Found volume group "VolGroup00" using metadata type lvm2

  • Determine how big is the volume group with vgdisk and grep commands

[root@atlast3vm9 ~]# vgdisplay VolGrpSRM | grep 'Total PE'
  Total PE              25599

  • Now use the PE value and lvcreate to create a logical volume

[root@atlast3vm9 ~]# lvcreate -n LVSRM -l 25599 VolGrpSRM
  Logical volume "LVSRM" created
[root@atlast3vm9 ~]# lvscan
  ACTIVE            '/dev/VolGrpSRM/LVSRM' [100.00 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol00' [18.38 GB] inherit
  ACTIVE            '/dev/VolGroup00/LogVol01' [1.03 GB] inherit

  • Create a file ext3 file system on volume

[root@atlast3vm9 ~]# mkdir -p /data/srm
[root@atlast3vm9 ~]# emacs -nw /etc/fstab
[root@atlast3vm9 ~]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/VolGrpSRM/LVSRM    /data/srm               ext3     defaults       0 0

  • Edit /etc/fstab adding /dev/VolGrpSRM/LVSRM to /data/srm mount point and mount it
[root@atlast3vm9 ~]# mkdir -p /data/srm
[root@atlast3vm9 ~]# emacs -nw /etc/fstab
[root@atlast3vm9 ~]# cat /etc/fstab
/dev/VolGroup00/LogVol00 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/VolGroup00/LogVol01 swap                    swap    defaults        0 0
/dev/VolGrpSRM/LVSRM    /data/srm               ext3     defaults       0 0
[root@atlast3vm9 ~]# mount -t ext3 /dev/VolGrpSRM/LVSRM    /data/srm

Cloning existing virtual machine


sudo virt-clone -o sl53-x86_64_v2 -n sl53-x86_64_v2_clone1 -f /var/lib/xen/images/sl53-x86_64_v2_clone1.img
Cloning from /var/lib/xen/images/sl53-x86_64_v2.img to /var/lib/xen/images/sl53-x86_64_v2_clone1.img
Cloning domain...                                                                                |  20 GB     06:14     


About This Site

Please note that this site is a content mirror of the BNL US ATLAS TWiki. To edit the content of this page, click the Edit this page button at the top of the page and log in with your US ATLAS computing account name and password.


Attachments

 
Powered by TWiki
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback