Skip to main content
Mount a file system in Linux
Last update:

Mount a file system in Linux

Before any operations in Rescue mode, you must mount the OS file system.

  1. Make sure that the server loaded in the Rescue recovery and diagnostic mode.

  2. Print information about the partitions on the available disks:

    fdisk -l
  3. 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.

  4. If the command infiltrate-root doesn't work, mount the file system manually.

  5. Perform recovery and diagnostic work.

  6. Log out of the environment after the job is complete. The partition will be unmounted automatically:

    exit

Mount the file system manually

  1. Make sure that the server is booted in the Rescue and Diagnostic mode.

  2. Print information about the partitions on the available disks:

    fdisk -l
  3. 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
  4. Mount the file system in the directory /mnt:

    mount /dev/sda1 /mnt

    Here. /dev/sda1 — partition on the disk you got in step 2.

  5. Connect to the environment using the command:

    chroot /mnt /bin/bash
  6. Perform recovery and diagnostic work.

  7. Exit the environment when the work is complete:

    exit
  8. Unmount the file system:

    umount /dev/sda1 /mnt