Untarring a fresh OS image
From PrgmrWiki
We'll use Debian for this example; this page details how to avoid Begin: Waiting for root file system ... errors.
Boot CentOS rescue (2.6.18-92.el5xen) from GRUB.
Log in as root.
If one of your filesystems is full or you upgraded to a bigger disk, you may want to Repartition before reinstalling.
Reformat your filesystem:
# mkfs.ext3 -L PRGMRDISK1 /dev/xvda1
The usual warnings about destroying all your data, etc., apply; presumably you know what you're doing. In the default image the root filesystem is mounted by volume label, but a user can change this if they want. The volume label can also be set with mkfs.ext3 -L or tune2fs -L. The current volume label and other details can also be read with tune2fs -l.
Mount your disk (-n prevents errors about /etc/mtab being read-only):
# mount -n /dev/xvda1 /mnt
Find the image you want in /distros:
# ls /distros centos64.tar.gz debian64.tar.gz lost+found netbsd64.tar.gz ubuntu64.tar.gz
The debian and ubuntu images were created with Debootstrap and you can create your own this way also. The CentOS image was created by running the installer as described on the CentOS wiki [1], with a kickstart file (/root/anaconda-ks.cfg in the CentOS image). There is very little specific to prgmr about these images, and users are free to make any changes as long as the file /boot/grub/menu.lst is loadable by pvgrub from the first filesystem on the first disk.
Now, untar it:
# tar xzf /distros/debian64.tar.gz -C /mnt
Set your new root password:
# chroot /mnt # passwd # exit
Finally, fix the GRUB menu if you don't want to use the volume label. Open /mnt/boot/grub/menu.lst in your favorite editor and replace LABEL=PRGMRDISK1 with /dev/xvda1. You'll end up with:
default=0 timeout=5 title Debian lenny root (hd0,0) kernel /boot/vmlinuz-2.6.26-1-xen-amd64 root=/dev/xvda1 ro initrd /boot/initrd.img-2.6.26-1-xen-amd64 title Debian lenny single user root (hd0,0) kernel /boot/vmlinuz-2.6.26-1-xen-amd64 root=/dev/xvda1 ro single initrd /boot/initrd.img-2.6.26-1-xen-amd64
Clean up and get out:
# cd # umount -n /mnt # shutdown -h now
Reboot into your new install; you should be all set.
Since this newly installed image is based upon a generic one, it doesn't know its static network configuration, so it cleverly uses DHCP to obtain a network connection. You may wish to change this to your static configuration.
Continuing the Debian example,
Run 'ifconfig eth0' and note your "inet addr" and "Mask" values.
Run 'route' or 'ip route' and note the IP of the default gateway.
Edit /etc/network/interfaces to remove:
iface eth0 inet dhcp
and replace it with:
iface eth0 inet static
address $ADDR
netmask $MASK
gateway $GATEWAY <- THIS MUST BE AN IP
what the kernel has now from dhcp. In debian you can also see the lease file from dhclient with this information in /var/lib/dhcp3/dhclient.leases and other files for each interface configured with dhclient.
Similarly, you may wish to modify /etc/fstab to replace "LABEL=PRGMRDISK1" with "/dev/xvda1". This will be necessary if you wish to use quotas.
