Increase KVM Guests Disk Space (Guests with LVM Partitions)

1) Shutdown the guest kvm. # virsh shutdown <kvm_guest_name> 2) Move the current image. # mv guest-kvm.img old-guest-kvm.img 3) Create a new image the same size you would like to increase the existing one by. # qemu-image create -f raw new.raw 10G 4) Concatenate the two images. # cat old-guest-kvm.img new.raw >> guest-kvm.img 5) Start the kvm guest. # virsh start <kvm_guest_name> 6) Run fdisk inside VM and delete &…

Read More >>

Resizing KVM guests disk

Follow these steps to resize a linux kvm guests disk. 1) Shutdown the vm. # virsh shutdown <guest_hostname> 2) Add 10GB to the disks image. # qemu-img resize guest_hostname.img +10G 3) Start the vm. # virsh start <guest_hostname> 4) Log on to the vm and fdisk the disk device. # fdisk /dev/vda 5) Print the partition table and take note of the start cylinder of the Linux LVM partition then delete the…

Read More >>

Creating Custom Acronis Backup 11.5 Bootable Media

Note: These steps have been verified with Acronis Backup 11.5.43956 and UltraISO version 9.6.1.3016. 1) Create an AcronisMedia.iso by clicking on Tools –> Create Bootable Media from within Acronis Backup. 2) Open the .iso image with UltraISO by clicking File–> Open. 3) Save the boot file from the .iso image by clicking Bootable –> Save Boot File. 4) Open the boot file by clicking File –> Open. 5) Extract the…

Read More >>

Finding package group names in CentOS 6 and RHEL6

To find the @shortname for a package group in CentOS 6 use the following command: # yum grouplist -v | sed -n ‘/Installed Groups:/,/Available Language Groups:/p’ Installed Groups: Additional Development (additional-devel) Base (base) Console internet tools (console-internet) Debugging Tools (debugging) Desktop (basic-desktop) Desktop Debugging and Performance Tools (desktop-debugging) Desktop Platform (desktop-platform) …   The name in parentheses is the @shortname that can be used in kickstart files. (ie. @base or…

Read More >>

Unpacking and repacking an initrd (Initial Ramdisk)

Here are the steps to unpack and repack an initrd. Unpacking: [root@localhost ~]# mkdir -p ./A/B [root@localhost ~]# cd A [root@localhost ~]# cp /boot/initrd-2.6.18-406 . [root@localhost ~]# mv initrd-2.6.18-406 initrd-2.6.18-406.gz [root@localhost ~]# gunzip initrd-2.6.18-406.gz [root@localhost ~]# cd B [root@localhost ~]# cpio -i < ../initrd-2.6.18-406 Make your changes to the filesystem which was decompressed to the cwd. Repacking: [root@localhost ~]# find | cpio -H newc -o > ../initrd-2.6.18-406.custom [root@localhost ~]# gzip…

Read More >>

Creating a custom ISO image in CentOS

1) Create a directory to mount your source. [root@localhost ~]# mkdir /tmp/bootiso 2) Loop mount the source ISO you are modifying. (Download from Red Hat / CentOS.) [root@localhost ~]# mount -o loop /path/to/some.iso /tmp/bootiso 3) Create a working directory for your customized media. [root@localhost ~]# mkdir /tmp/bootisoks 4) Copy the source media to the working directory. [root@localhost ~]# cp -r /tmp/bootiso/. /tmp/bootisoks/ 5) Unmount the source ISO and remove the…

Read More >>

The file /boot/grub/stage1 not read correctly

After pxe booting a server and installing linux from a cpio archive, grub failed to load using the grub-install command. The error presented was as follows: root@pxe:~# mkdir /target root@pxe:~# mount /dev/sda1 /target root@pxe:~# chroot /target root@pxe:~# grub-install /dev/sda The file /boot/grub/stage1 not read correctly. Since command line didn’t work, I tried installing grub via the grub shell: root@pxe:~# grub GNU GRUB version 0.97 (640K lower / 3072K upper memory)…

Read More >>

LVM commands

 Just some commands for working with LVM’s [root@localhost ~]# lvdisplay | awk ‘/LV Path/{n=$3} /Block device/{d=$3; sub(“.*:”,”dm-“,d); print d,n;}’dm-0 /dev/centos/swap dm-1 /dev/centos/root dm-2 /dev/vg_data/lv_data [root@localhost ~]# dmsetup ls vg_data-lv_data (253:2) centos-swap (253:0) centos-root (253:1) [root@localhost ~]# pvs PV VG Fmt Attr PSize PFree /dev/md1 vg_data lvm2 a– 7.28t 0 /dev/sdg2 centos lvm2 a– 135.48g 0 [root@localhost ~]# lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert…

Read More >>

Selinux

Full selinux status: [root@localhost ~]# sestatusSELinux status: enabled SELinuxfs mount: /selinux Current mode: permissive Mode from config file: permissive Policy version: 24 Policy from config file: targeted To Disable selinux: [root@localhost ~]# setenforce 0 To Enable selinux: [root@localhost ~]# setenforce 1 To quickly see if selinux is running [root@localhost ~]# getenforcePermissive The selinux configuration file is located at /etc/sysconfig/selinux

Read More >>

UUID’s and disk labels

A file system can be mounted in /etc/fstab by its device path (/dev/mapper/vg_data-lv_vol1) its UUID or its FS label. Use this command to check the swap partitions label: [root@localhost ~]# dd if=/dev/mapper/vg_localhost-lv_swap bs=4k count=1 | xxd -a | grep -E ‘410|420’ 0000410: bda1 4fe9 b0a8 1cf0 1b03 2185 6561 7461 ..O…….!.MY 0000420: 746a 6f65 7364 6f6e 7574 7300 0000 0000 SWAPLABEL1234….. 1+0 records in 1+0 records out 4096 bytes (4.1…

Read More >>