Mount a file system in Linux
Before any operations in Rescue mode, you must mount the OS file system.
-
Make sure that the server loaded in the Rescue recovery and diagnostic mode.
-
Print information about the partitions on the available disks:
fdisk -l
-
Mount the file system, the partition will be mounted in the directory
/newroot
:infiltrate-root /dev/sda1
Here.
/dev/sda1
— partition on the disk you got in step 2. -
If the command
infiltrate-root
doesn't work, mount the file system manually. -
Perform recovery and diagnostic work.
-
Log out of the environment after the job is complete. The partition will be unmounted automatically:
exit
Mount the file system manually
-
Make sure that the server is booted in the Rescue and Diagnostic mode.
-
Print information about the partitions on the available disks:
fdisk -l
-
If the server OS has a non-RAID partitioned disk, skip this step. If the disk is partitioned with RAID, make sure it is built — the disk information you got in step 2 will contain entries like
/dev/md
. If they are not present, assemble the components of the previously created RAID into a RAID:mdadm --assemble --scan
-
Mount the file system in the directory
/mnt
:mount /dev/sda1 /mnt
Here.
/dev/sda1
— partition on the disk you got in step 2. -
Connect to the environment using the command:
chroot /mnt /bin/bash
-
Perform recovery and diagnostic work.
-
Exit the environment when the work is complete:
exit
-
Unmount the file system:
umount /dev/sda1 /mnt