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.
-
Output data about storage devices (disks and partitions created on them):
fdisk -l
-
Determine if LVM (logical volume manager) is in use:
- If LVM is used, the list of storage devices will include entries with
root
type name/dev/mapper/vg0-root
; - If LVM is not used, the list of storage devices will contain entries of type
/dev/sda1
,/dev/sdb1
et cetera.
- If LVM is used, the list of storage devices will include entries with
-
Mount the file system, the partition will be mounted in the directory
/newroot
:- with LVM:
infiltrate-root /dev/mapper/vg0-root
- without LVM:
infiltrate-root /dev/sda1
-
If the command
infiltrate-root
doesn't work, mount the file system manually. -
Perform recovery and diagnostic work.
-
When finished, exit the environment. 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.
-
Output data about storage devices (disks and partitions created on them):
fdisk -l
-
If the server OS has disk partitioning without RAID, skip this step. If the disk is partitioned with RAID (RAID + LVM), check if it is built. If RAID is built, the list of storage devices 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
-
Determine if LVM (logical volume manager) is in use:
- If LVM is used, the list of storage devices will contain entries with root type name
/dev/mapper/vg0-root
; - If LVM is not used, the list of storage devices will contain entries of type
/dev/sda1
,/dev/sdb1
et cetera.
- If LVM is used, the list of storage devices will contain entries with root type name
-
Mount the file system, the partition will be mounted in the /mnt directory:
- with LVM :
mount /dev/mapper/vg0-root /mnt
- without LVM:
mount /dev/sda1 /mnt
-
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