[CentOS] Lost path to root directory!

Mon Sep 18 11:46:46 UTC 2006
William L. Maltby <CentOS4Bill at triad.rr.com>

On Sun, 2006-09-17 at 22:22 -0400, Ted Miller wrote: 
> 
> William L. Maltby wrote:
> > On Sun, 2006-09-17 at 09:27 -0400, Ted Miller wrote:
> > 
> >>I'll admit I am new to LVM2, but I have got myself in a bad spot.
> >>
> >>I renamed the LVM volume and volume group so that I can keep track of what
> >>is in them.  I have changed grub's menu.lst, /etc/fstab, and /etc/mtab, but
> >>somewhere else there is still something telling lvm that my root drive is
> >>on VolGroup00.  Where is it, and how do I convince it that
> >>VolGroup00/Volume00 (or whatever the defaults are) is now DriveC/Centos?  I
> >>suspect it may be hiding in initrd (compressed).
                                        ^^^^^^^^^^
I didn't repeat this since you spotted it already.

> > 
> > Yep. Fortunately, thats a cpio file. So uncompress, go to tmp make a
                                            ^^^^^^^^^^
Did you remember to do the above? Based on your file name I suspect not.

# file /boot/initrd*
/boot/initrd-2.6.9-34.EL.img:     gzip compressed data, from Unix, max
compression
/boot/initrd-2.6.9-42.0.2.EL.img: gzip compressed data, from Unix, max
compression

My use of the -I (your -F) presumed that you did something like

    gzip -dc <your-compressed-image >a-temp-file

but you could just as easily gzip -dc <image | cpio -idmvc # No -I/-F

> > work dir and "cpio -idmvc -I <your uncompressed file name>".
> 
> I tried this, but I get the message:
> [root at Office2 /home/tmiller/tmp/centos01]$cpio -idmvc -F
> /media/centos/boot/initrd-2.6.9-34.EL.img
> cpio: premature end of file
> 
> No files show up in the directory.  Any ideas appreciated.  Doing this in
> Mandrake 2006.0.

Replace the "t" with "d" in either of the "itmcv" below and it will
extract instead of giving a TOC.

# gzip -dc </boot/initrd-2.6.9-34.EL.img | cpio -itmvc|head -10
4166 blocks
drwx------  10 root     root            0 Aug 28 19:07 .
drwxr-xr-x   2 root     root            0 Aug 28 19:07 sys
drwxr-xr-x   2 root     root            0 Aug 28 19:07 sysroot
drwxr-xr-x   2 root     root            0 Aug 28 19:07 dev
crw-r--r--   1 root     root       4,   0 Aug 28 19:07 dev/systty
crw-r--r--   1 root     root       4,   1 Aug 28 19:07 dev/tty1
brw-r--r--   1 root     root       1,   1 Aug 28 19:07 dev/ram
crw-r--r--   1 root     root       4,   3 Aug 28 19:07 dev/tty3
crw-r--r--   1 root     root       1,   3 Aug 28 19:07 dev/null
crw-r--r--   1 root     root       4,   4 Aug 28 19:07 dev/tty4

# gzip -dc </boot/initrd-2.6.9-34.EL.img >/tmp/test
# cpio -itmvc -I /tmp/test|head -10 4166 blocks
drwx------  10 root     root            0 Aug 28 19:07 .
drwxr-xr-x   2 root     root            0 Aug 28 19:07 sys
drwxr-xr-x   2 root     root            0 Aug 28 19:07 sysroot
drwxr-xr-x   2 root     root            0 Aug 28 19:07 dev
crw-r--r--   1 root     root       4,   0 Aug 28 19:07 dev/systty
crw-r--r--   1 root     root       4,   1 Aug 28 19:07 dev/tty1
brw-r--r--   1 root     root       1,   1 Aug 28 19:07 dev/ram
crw-r--r--   1 root     root       4,   3 Aug 28 19:07 dev/tty3
crw-r--r--   1 root     root       1,   3 Aug 28 19:07 dev/null
crw-r--r--   1 root     root       4,   4 Aug 28 19:07 dev/tty4
> 
> Ted Miller
> 
> > Then cd
> > into the dir and find . -name init. Edit that file. There's two
> > "ingnorelockingfailure" imperatives in there. One of them names the
> > volgroup. Add yours to the list (comma, IIRC - use the man page if there
> > is one).
> > 
> > Then cpio it back up by using the -c param and compress it.
> > 
> > Bill
> <snip sig stuff>

HTH
--
Bill