Skip to main content

Bare-Metal Servers - Rescue

Allnodes Team avatar
Written by Allnodes Team
Updated yesterday

How to mount all available disks in rescue

  1. Open your server in "Allnodes Control Panel".

  2. Click on "Rescue" tab.

  3. Select "Grml Linux" option, choose "SSH Keys", set root password, and press "START RESCUE" buton.

  4. Wait until server is booted in rescue (Can take up to 30 min for EPYC).

  5. Login into your server by ssh.

  6. Run the script below:

    cat <<\EOF | bash
    # Root filesystem mountpoint
    ROOT_PATH=/mnt

    # Assemble RAID devices if any
    mdadm --assemble --scan

    # Scan and enable all LVM volumes
    pvscan
    vgscan
    vgchange -ay

    # Mount the root filesystem
    mount /dev/vg0/root "${ROOT_PATH}"
    if [[ $? -ne 0 ]]; then
    echo "Unable to mount the root filesystem, exiting." >&2
    exit 1
    fi

    # Check if /etc/fstab exists on the host system
    if [[ ! -f "${ROOT_PATH}/etc/fstab" ]]; then
    echo "Unable to locate /etc/fstab on the root filesystem, exiting." >&2
    exit 1
    fi

    # Mount all non-root filesystems present in /etc/fstab, excluding swap
    while read dev mnt type opt dump pass; do
    [[ $dev =~ ^# ]] && continue
    [[ -z "${dev// /}" ]] && continue
    [[ $mnt == "/" ]] && continue
    [[ $type == "swap" ]] && continue
    echo "Mounting ${dev} on ${ROOT_PATH}${mnt}"
    mkdir -p "${ROOT_PATH}/${mnt}"
    mount -o "${opt}" "${dev}" "${ROOT_PATH}${mnt}"
    done <<< $(cat "${ROOT_PATH}/etc/fstab")
    EOF
  7. Server is ready for actions in rescue.

Have Questions?
Send us an email at [email protected]

Did this answer your question?