How to mount your system with live CD

more then once I was needed to reconfigure my ubuntu grub or change the root password of a certain machine.
If you can't login to the machine or you don't have your root password,
the easy way to do so is to mount the system from a live CD.
I'm using Ubuntu 9.04 live CD:

insert the live CD to your cdrom and restart the computer.
chose the first option of the main menu -
"Try ubuntu whitout any change to your computer"


when it finish loading, open the terminal console and run the next commands.
first we need to find your linux partition
# sudo fdisk -l

than we need to mount into it
# sudo mkdir /mnt/root
# sudo mount -t ext3 /dev/sda1 /mnt/root
# sudo mount -t proc none /mnt/root/proc
# sudo mount -o bind /dev /mnt/root/dev
# sudo chroot /mnt/root /bin/bash

That's it, Now you login the machine as root user, and you can do what ever you want.

for reinstall grub you can use grub-install:
# grub-install /dev/sda1
or
# grub
grub> find /boot/grub/stage1
grub> root (hd?,?)
grub> setup (hd?)
grub> quit

or change the root password with passwd:
# passwd root


No comments:

Post a Comment