Reputation: 4302
I am learning amazon EC2 using the EC2 user guide document. My aim is to attach an EBS volume to a running EC2 instance. I have already done this successfully. However I now want to mount it after connecting through the SSH from my linux machine. I have successfully done the steps provided in the manual:
sudo mkdir /mnt/my-data
sudo mount /dev/sdf /mnt/my-data
(however in my case the sudo mount /dev/sdf1 /mnt/my-data worked instead)
But I can't view the contents using ls /mnt/my-data
(which is also provided as step in the user guide).
Do you know why this is happening?
Upvotes: 3
Views: 2807
Reputation: 9561
When you create /mnt/my-data using the above two commands, the directory ends up being owned by root. In order to change this:
sudo chown -R ec2-user:ec2-user /mnt/my-data
(Assuming ec2-user is your current user.)
Now it should work and you should be able to use that directory as your regular user.
Upvotes: 13
Reputation: 74
Or, here's another syntax example:
get filesystem info:
ubuntu@ip-10-29-192-104:/mnt$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 7.9G 883M 6.7G 12% / udev 819M 12K 819M 1% /dev tmpfs 331M 172K 331M 1% /run none 5.0M 0 5.0M 0% /run/lock none 827M 0 827M 0% /run/shm /dev/xvdb 147G 188M 140G 1% /mnt
In this case, the new EBS is mounted on /mnt This is an Ubuntu image, so the username is ubuntu.
sudo chown -R ubuntu:ubuntu /mnt/
Now the /mnt is owned by "ubuntu" not "root"
Upvotes: 0