Archive for August, 2020

Aug 8 2020

Mount partition and chroot in rescue mode

Run linux from Linux Live (debian.ubuntu, slackware tec.)

Determine what is your main partition

fdisk -l

Example output:

Disk /dev/md2: 9.77 GiB, 10495328256 bytes, 20498688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/md3: 221.88 GiB, 238236860416 bytes, 465306368 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/md1: 9.77 GiB, 10495328256 bytes, 20498688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/md0: 3.91 GiB, 4203020288 bytes, 8209024 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

create mount point and mount root partition

mkdir /mnt/md0

mount /dev/md0 /mnt/md0

Mount the necessary file system directories by running the following commands:

mount -t proc /proc /mnt/md0/proc

mount –rbind /sys /mnt/md0/sys

mount –rbind /dev /mnt/md0/dev

Mount /usr and /var partition if necessary

mount /dev/md1 /mnt/md0/usr

mount /dev/md2 /mnt/md0/var

Chroot to md0

chroot /mnt/md0