Using Ubuntu’s LVM commands
I changed my password today on my Red Hat desktop. In the process, I misspelled the password. I tried to change it with the passwd command, but the system told me I needed more time before I was allowed to change my password. bleh.
So, I logged in as root, ran passwd myusername and typed the password correctly. Something was wrong. My tty was acting all weird and inserting too many carriage returns. My password was now corrupt and I had no idea why. “No problem,” I though, “I’ll just log in as root again and fix it right up!” No dice. The root password got corrupted somewhere in the middle of the whole mess.
I rebooted. Still no dice. I boot off of an old Ubuntu Server install disk I had laying around. No dice. Ubuntu server doesn’t have the LVM packages. I got Phreakre to burn me an Ubuntu Desktop CD and booted off it. I still couldn’t get the Disk mounted, but only becuase I didn’t know the proper LVM commands to make it happen. These are the commands I used:
First, vgscan, which will run around the hardware looking for LVM volumnes and print out the groups for use in the next commands:
[root@irkenshost ~]# vgscan Reading all physical volumes. This may take a while... Found volume group "VolGroup00" using metadata type lvm2
Next, I needed to run the vgchange command to activate the LVM volume group and add an entry in the /dev directory:
[root@irkenshost ~]# vgchange -ay VolGroup00
Then, to find the volume itself, I issued an lvs command. Most likely, the volume I was looking for is the default, LogVol00:
[root@irkenshost ~]# lvs
Finally, I mounted that volume to /mnt so I could edit the /etc/shadow file and zero-out the root password:
[root@irkenshost ~]# mount /dev/VolGroup00/LogVol00 /mnt