Friday, October 25, 2013

Fixing Ubuntu Postgres Install

Ubuntu chose to install the default database as LATIN1, this is a problem for "double byte" languages and may cause issues with other languages.

To fix it:

Switch to root then:

export LANGUAGE="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
pg_dropcluster --stop 9.1 main
pg_createcluster --start -e UTF-8 9.1 main
 
NOTE: This completely nukes your DB install,
don't do this if you already have data in the database.

Thursday, September 5, 2013

Accessing a LVM partion inside a Guest OS Raw Image

Sometimes its handy to be able to access the contents of a Guest OS image before/without booting it up.

It can be a pain as the kernel doesn't recognize the devices without a few extra commands.

For quick refence here they are:

To mount an LVM partition:

  • kpartx -a /var/lib/libvirt/images/CentOSGuest.img
  • pvscan
  • vgchange -ay vg_centguest
  • mount /dev/mapper/vg_centguest-lv_root /mnt
Note: The pvscan is optional, it's useful to allow you to check the group name.

Then to un-mount:
  • umount /mnt
  • vgchange -an vg_centguest
  • kpartx -d /var/lib/libvirt/images/CentGuesst.img

Behind the scenes, this will create a loop device /dev/loop0 so you may want to increase the number of available devices by editing /etc/modules.conf and add the following line:

options loop max_loop=64