Using the rescue system (advanced)
From openSUSE
|
Contents |
Situation
You need to mount all your file systems or reinstall your boot loader, but cannot or choose not to do so by starting the computer in the normal fashion.
Procedure
Start the rescue system
- Boot from the openSUSE 11.1 CD or DVD.
- Select Rescue System
- Login as "root" (there's no password)
Listing the file systems
First, we need to a list of storage devices with filesystems to mount. We can usually just ask the kernel what partitions it is aware of:
cat /proc/partitions
To ask the hard drive for a list of partitions, which helps because the partition table also may include useful partition type information, perform the following. The device /dev/sda is most typical for modern computers as the primary hard drive. On older non-SATA systems, it is usually /dev/hda. If there are multiple drives, it is harmless to query a device using this method when you don't know for sure if it is the correct device. Just don't forget the lowercase L option which only lists and doesn't put you into partition edit mode.
fdisk -l /dev/sda
- Note which partitions are mounted at which points in your filesystem. For instance, most Linux users will have at least a swap and root (/) partition. Some will have a separate /home, /usr or /var partition. If you don't know which partitions are which by size or order, you might have to mount them experimentally to find which are which.
For the sake of simplicity in this article, we'll assume the partition table looks like this:
| device | mount point |
|---|---|
| /dev/sda1 | /boot |
| /dev/sda2 | swap |
| /dev/sda3 | / |
| /dev/sda4 | /home |
Unlock encrypted partitions
If you are using encrypted partitions with LUKS, you will need to unlock them before using them. To do this, you will need to use cryptsetup.
cryptsetup luksOpen /dev/sda3 root
In the above case, your root partition device would then be /dev/mapper/root.
Make the swap available
Mounting the swap space allows us more memory space and better control over physical memory.
swapon /dev/sda2
Mount your file systems
Mount root file system
mount /dev/sda3 /mnt
Mount boot file system, if separate
mount /dev/sda1 /mnt/boot
Bind mount temporary file systems
mount --bind /dev /mnt/dev mount --bind /proc /mnt/proc mount --bind /sys /mnt/sys
Mount other partitions
mount /dev/sda4 /mnt/home
Prepare and enter the new root
Copy your mounts and DNS resolution files
cp /etc/mtab /mnt/etc/mtab cp /etc/resolv.conf /mnt/etc/resolv.conf
Make the mount point the new root
chroot /mnt /bin/bash
Get work done in your file system
At this point, you should have an entirely usable file system that should closely match your normal file system. It should be possible to mount other media and copy files or re-install the boot loader.
Optional: Reload the boot loader
Reload boot loader, if desired
- Launch yast
- Navigate to System > Boot Loader
- Select boot loader installation
- Check Boot Loader Location > Boot from Master Boot Record
Cleaning up
Once done with your file system, you can exit and reboot.
- Exit the new root and unmount all your filesytems.
exit umount /mnt/boot umount /mnt/dev umount /mnt/proc umount /mnt/sys umount /mnt/home umount /mnt
If you get an error with the last command, you may need to unmount other file systems. Use "mount" to see what filesystems are mounted.
Then
reboot
See Also
Keywords: rescuesystem

