Skip to content

Unable to Mount Disk to lightsail instance - Command Not Found error

0

I am trying to mount a newly created disk (24 hours ago). I am following the recommended method from AWS docs https://docs.aws.amazon.com/en_us/lightsail/latest/userguide/create-and-attach-additional-block-storage-disks-linux-unix.html However, in terminal when trying to enter the specified commands I get the command not found error. Having done some research I tried some alternative command recommended by basic support but get the same error, I am unable to install util-linux which i believe is what contains the required tools. here is an example of what happens: (I've anonymised it) [ec2-user@]$ lsblk -bash: lsblk: command not found [ec2-user@]$ sudo lsblk -bash: sudo: command not found [ec2-user@]$ sudo lsblk -bash: sudo: command not found [ec2-user@]$ ^C [ec2-user@]$ sudo fdisk -l -bash: sudo: command not found [ec2-user@]$ ls -la /dev/xvd* ls: cannot access '/dev/xvd*': No such file or directory

I have confirmed in lightsail that the disk is present and attached to my instance, also in the same region so no issues there.

Any recommendations from users who have seen this before? Instance is running Almalinux

asked 10 months ago292 views

2 Answers
0

Hello.

Is it possible to check the path settings using the following command?

echo $PATH

Also, is it possible to execute the command with the full path as follows?
The lsblk command is probably installed on most Linux operating systems, so if you can't find the command, it's possible that you accidentally deleted a directory.

/usr/bin/lsblk
EXPERT

answered 10 months ago

  • Thanks for your response. This is the output, [ec2-user@***]$ echo $PATH /usr/local/cpanel/3rdparty/lib/path-bin:/usr/share/Modules/bin:/usr/local/cpanel/3rdparty/lib/path-bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin

    I tried your alternate suggestion and got this: [ec2-user@***]$ /usr/bin/lsblk -bash: /usr/bin/lsblk: No such file or directory Which of the path folders would you expect to contain tools like lsblk?

    Apologies as I'm not an experienced Nix admin ;)

0

It appears you're experiencing an issue with basic Linux commands not being available in your Lightsail instance. This suggests you might be using a minimal or custom image that doesn't include standard Linux utilities.

The error messages indicate that both lsblk and even sudo commands are not found, which is unusual for standard Linux distributions. Here are some steps to troubleshoot:

  1. First, check what shell you're using and what Linux distribution is running:
echo $SHELL
cat /etc/os-release
  1. Since you can't use lsblk or sudo, try these alternative commands to see your disks:
ls -la /dev/
cat /proc/partitions
  1. To see if your disk is attached at the system level, you can try:
df -h
  1. If you need to install the missing utilities, you'll need to use the package manager available on your system. Since sudo isn't available, you might need to use:
yum install util-linux

Or if you're on a Debian-based system:

apt-get install util-linux

If these commands also fail, you might need to:

  • Create a snapshot of your instance
  • Launch a new instance with a standard Amazon Linux or Ubuntu image
  • Attach your disk to the new instance

Remember that when attaching a disk to a Lightsail instance, both the disk and instance must be in the same AWS Region and Availability Zone. Based on your description, you've already confirmed this is not the issue.
Sources
Resolve Lightsail disk attachment and usage issues - Amazon Lightsail
Create and attach Lightsail block storage disks to Linux instances - Amazon Lightsail
Troubleshoot issues connecting to your Amazon EC2 Linux instance - Amazon Elastic Compute Cloud

answered 10 months ago

EXPERT

reviewed 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.