1

I have an AWS instance with an encrypted EBS volume, which is at /dev/sdb.

I am trying to mount it via ansible using the command:

- name: format new volume
  filesystem: fstype=xfs dev=/dev/xvdb

- name: edit fstab and mount the vol
  action: mount=/home/ec2-user/ name= src=/dev/xvdb opts=noatime fstype=xfs state=mounted

I have put in xvdb after the suggestion from this answer: https://serverfault.com/a/365841/314047

However, I still get the error: "msg": "Device /dev/xvdb not found." PS: I get this error with /dev/sdb too.

This is the O/P of my ls -l /dev/sd* /dev/xv*

lrwxrwxrwx 1 root root       4 Feb 10 06:45 /dev/sda -> xvda
lrwxrwxrwx 1 root root       5 Feb 10 06:45 /dev/sda1 -> xvda1
lrwxrwxrwx 1 root root       4 Feb 10 06:45 /dev/sdb -> xvdb
brw-rw---- 1 root disk 202,  0 Feb 10 06:45 /dev/xvda
brw-rw---- 1 root disk 202,  1 Feb 10 06:45 /dev/xvda1
brw-rw---- 1 root disk 202, 16 Feb 10 06:45 /dev/xvdb

This command: cat /proc/partitions gives me this:

major minor  #blocks  name

 202        0    8388608 xvda
 202        1    8386543 xvda1
 202       16    8388608 xvdb

Is there anything which I did wrong? How do I mount my volume and cd into it?

Dawny33
  • 133
  • 1
  • 7
  • 2
    Try doing it manually first, then automate it. There are manual steps here http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html – Tim Feb 10 '17 at 08:07
  • @Tim Yeah, going through that now :) . Looks like I need to do a lot of steps before I can mount it! – Dawny33 Feb 10 '17 at 08:25

1 Answers1

2

Looks like you haven't partitioned and formatted it, you will have to first partition it using fdisk and then create a ext4/3 partition using makefs. You can check out the documentation here.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

HackToHell
  • 250
  • 1
  • 4
  • 15