Thursday, October 11, 2012

centos 6.3 enter single user mode and fix lvm partiton

1) enter grub.
2) add "single" as kernel paramters
3) boot into single user mode.
4) if file system is read-only, do:
  mount -o remount,rw /
5) recreate the volume group:
 vgcreate new_vol_name /dev/sd*
6) create logical volume and use full volume groupt
lvcreate -l 100%FREE -n new_lv_name  your_vg_name
7)format the logical volume
a, http://blog.tsunanet.net/2011/08/mkfsxfs-raid10-optimal-performance.html
b,http://wikihelp.autodesk.com/Creative_Finishing/enu/2012/Help/05_Installation_Guides/Installation_and_Configuration_Guide_for_Linux_Workstations/0118-Advanced118/0194-Manually194/0199-Creating199

//comment: use the second (autodesk one) method is fast and stable.
remeber, if your disk has BBU setup. you need to disable barrier.
just do it while mount the xfs partion with "-o nobarrier". please google centos documents.

reference:
1) http://www.centos.org/docs/5/html/Cluster_Logical_Volume_Manager/LV_create.html

2:

Root your box, and mount LVM partitions

I was teaching a friend how to root a box by adding:

init=/bin/bash
to the kernel line in grub, and then wanted to show him how to install some apps from the command line. I had never done this with LVM partitions, and was surprised when I got the following error:

File based locking initialization failed
Doh! I forgot to remount root read/write:

mount -o remount,rw /
Finally, I was able to mount all my LVM partitions with:
lvm vgscan
lvm vgchange -ay
lvm lvs
mount -a
haha! I'm getting rusty :P

1 comment:

darkfader said...

hi, i had to throw in one more
lvm vgmknodes after the vgchange -ay


Thanks for helping my memory :)

Florian