<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alfredo Cambera</title>
    <description>The latest articles on DEV Community by Alfredo Cambera (@alfredocambera).</description>
    <link>https://dev.to/alfredocambera</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F26494%2F6e1a5b1c-e5c2-41a7-9b10-33f656ad795c.png</url>
      <title>DEV Community: Alfredo Cambera</title>
      <link>https://dev.to/alfredocambera</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alfredocambera"/>
    <language>en</language>
    <item>
      <title>How to map EBS block devices on Ubuntu 20.04 EC2 instances</title>
      <dc:creator>Alfredo Cambera</dc:creator>
      <pubDate>Tue, 21 Jul 2020 20:51:55 +0000</pubDate>
      <link>https://dev.to/alfredocambera/how-to-map-ebs-block-devices-on-ubuntu-20-04-ec2-instances-2lp7</link>
      <guid>https://dev.to/alfredocambera/how-to-map-ebs-block-devices-on-ubuntu-20-04-ec2-instances-2lp7</guid>
      <description>&lt;h1&gt;
  
  
  How to Map EBS Block Devices on Ubuntu 20.04 Instances
&lt;/h1&gt;

&lt;p&gt;Attaching an EBS volume to an EC2 instance makes it available to store data. What can cause confusion is that the device name shown in the AWS console is not the same as the one generated by the Linux Kernel.&lt;/p&gt;

&lt;p&gt;When I found out about this problem, the first thing I thought was:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why on earth would AWS show an incorrect device name? This doesn't make any sense!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The short answer is:&lt;/strong&gt; They don't.&lt;/p&gt;

&lt;p&gt;EBS device mapping works just fine on &lt;a href="https://dev.toabout:blank"&gt;Amazon Linux AMIs&lt;/a&gt; because it is supported and maintained by AWS. The problem is on Linux AMIs, like Ubuntu, as it’s created by third-party providers.&lt;/p&gt;

&lt;p&gt;I dug deeper into this problem, and I found out that this issue had two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The block device driver used on the Linux kernel&lt;/strong&gt;: There are as many kernel versions in the AWS Marketplace as &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html"&gt;AMI&lt;/a&gt;s. This doesn't mean that the naming scheme is completely different from AMI to AMI. It means that you need to be aware of its variations to reliably manage EBS volumes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The virtualization technology used by the instance&lt;/strong&gt;: AWS offers the Xen hypervisor and &lt;a href="https://aws.amazon.com/ec2/nitro/"&gt;Nitro&lt;/a&gt; technologies to power &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/virtualization_types.html"&gt;AMI HVM&lt;/a&gt; instances. Depending on the &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html"&gt;instance type&lt;/a&gt; you choose for your instance you’ll use one or another.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The device response time:&lt;/strong&gt; Block devices can respond to discovery in a different order in subsequent instance starts,                                        which causes the device name to change.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In this post, I'll share what I learned while troubleshooting this problem. Hopefully, it will help you avoid some headaches.&lt;/p&gt;

&lt;h2&gt;
  
  
  How this issue can affect you?
&lt;/h2&gt;

&lt;p&gt;Working with EBS volumes that you can't reliably identify can generate some self-inflicted damage. Here are some possible scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You could format the incorrect device.&lt;/li&gt;
&lt;li&gt;You could schedule EBS snapshots for the incorrect disk.&lt;/li&gt;
&lt;li&gt;Tools relying on the AWS API to identify disks can run into problems when working with disk volumes: Ansible, SaltStack, AWS SDK, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Let's reproduce the issue
&lt;/h2&gt;

&lt;p&gt;I’ll create two environments, one per virtualization technology: &lt;strong&gt;Environment A - Xen&lt;/strong&gt; and &lt;strong&gt;Environment B - Nitro&lt;/strong&gt;.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;EC2 instance configuration&lt;/th&gt;
&lt;th&gt;Environment A - Xen&lt;/th&gt;
&lt;th&gt;Environment B - Nitro&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hostname&lt;/td&gt;
&lt;td&gt;env-a&lt;/td&gt;
&lt;td&gt;env-b&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;AMI name&lt;/td&gt;
&lt;td&gt;Ubuntu Server 20.04 LTS&lt;/td&gt;
&lt;td&gt;Ubuntu Server 20.04 LTS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Instance type&lt;/td&gt;
&lt;td&gt;t2.micro&lt;/td&gt;
&lt;td&gt;t3a.nano&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Virtualization technology&lt;/td&gt;
&lt;td&gt;Xen&lt;/td&gt;
&lt;td&gt;Nitro&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Region&lt;/td&gt;
&lt;td&gt;us-east-1&lt;/td&gt;
&lt;td&gt;us-east-1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tag (Name)&lt;/td&gt;
&lt;td&gt;env-a&lt;/td&gt;
&lt;td&gt;env-b&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;EBS volume configuration&lt;/th&gt;
&lt;th&gt;Environment A - Xen&lt;/th&gt;
&lt;th&gt;Environment B - Nitro&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Size&lt;/td&gt;
&lt;td&gt;10GiB&lt;/td&gt;
&lt;td&gt;10GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Volume type&lt;/td&gt;
&lt;td&gt;General Purpose SSD (gp2)&lt;/td&gt;
&lt;td&gt;General Purpose SSD (gp2)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Region&lt;/td&gt;
&lt;td&gt;us-east-1&lt;/td&gt;
&lt;td&gt;us-east-1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tag (Name)&lt;/td&gt;
&lt;td&gt;env-a-disk&lt;/td&gt;
&lt;td&gt;env-b-disk&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Then, I’ll use the &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html"&gt;EC2 Instance Metadata Service&lt;/a&gt; and the AWS Command Line Interface (awscli) to gather disk information from the AWS API.&lt;/p&gt;

&lt;h3&gt;
  
  
  Troubleshooting "Environment A - Xen"
&lt;/h3&gt;

&lt;p&gt;To confirm you’re working on a Xen instance, run the following command. You should get the same output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a:~&lt;span class="nv"&gt;$ &lt;/span&gt;file /sys/hypervisor/uuid
/sys/hypervisor/uuid: ASCII text
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To get volume id and the device name generated by AWS, we use the awscli with the device tag &lt;code&gt;env-a-disk&lt;/code&gt;  as a parameter for the filter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a:~&lt;span class="nv"&gt;$ INSTANCE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s2"&gt;"http://169.254.169.254/2012-01-12/meta-data/instance-id"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
ubuntu@lab-a:~&lt;span class="nv"&gt;$ &lt;/span&gt;aws ec2 describe-volumes &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--filters&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="s2"&gt;"Name=attachment.instance-id,Values=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;INSTANCE_ID&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="s2"&gt;"Name=tag:Name,Values=env-a-disk"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="s2"&gt;"Volumes[].Attachments[].[Device,VolumeId]"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output&lt;/span&gt; json
&lt;span class="o"&gt;[&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"/dev/sdb"&lt;/span&gt;,
        &lt;span class="s2"&gt;"vol-09550e13d86b13653"&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you try to access the disk using the device name generated by AWS, you’ll get the following error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a:~&lt;span class="nv"&gt;$ &lt;/span&gt;file /dev/sdb
/dev/sdb: cannot open &lt;span class="sb"&gt;`&lt;/span&gt;/dev/sdf&lt;span class="s1"&gt;' (No such file or directory)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Xen block device naming scheme has two parts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Xen devices namespace: &lt;code&gt;/dev/xvd&lt;/code&gt;. It’s used as a prefix for every block device.&lt;/li&gt;
&lt;li&gt;The last letter of the device name provided by AWS. In this case, it will be b, from /&lt;code&gt;dev/sdb&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The EBS volume name will be the result of joining &lt;code&gt;/dev/xvd&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;: /dev/xvdf. Let's check it out:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a:~&lt;span class="nv"&gt;$ &lt;/span&gt;file /dev/xvdb
/dev/xvdb: block special &lt;span class="o"&gt;(&lt;/span&gt;202/16&lt;span class="o"&gt;)&lt;/span&gt;
ubuntu@lab-a:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;fdisk &lt;span class="nt"&gt;-l&lt;/span&gt; /dev/xvdb
Disk /dev/xvdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 &lt;span class="k"&gt;*&lt;/span&gt; 512 &lt;span class="o"&gt;=&lt;/span&gt; 512 bytes
Sector size &lt;span class="o"&gt;(&lt;/span&gt;logical/physical&lt;span class="o"&gt;)&lt;/span&gt;: 512 bytes / 512 bytes
I/O size &lt;span class="o"&gt;(&lt;/span&gt;minimum/optimal&lt;span class="o"&gt;)&lt;/span&gt;: 512 bytes / 512 bytes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now that you have successfully identified the disk, you’re ready to create a symlink to the device name provided by AWS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /dev/xvdf /dev/sdf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Troubleshooting "Environment B - Nitro"
&lt;/h3&gt;

&lt;p&gt;To confirm you’re working on a Nitro instance, run the following command. You should get the same output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-b:~&lt;span class="nv"&gt;$ &lt;/span&gt;file /sys/devices/virtual/dmi/id/board_asset_tag
/sys/devices/virtual/dmi/id/board_asset_tag: ASCII text
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;To match the volume ID with the device, you need to get the required information from the AWS API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-b:~&lt;span class="nv"&gt;$ INSTANCE_ID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="s2"&gt;"http://169.254.169.254/2012-01-12/meta-data/instance-id"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
ubuntu@lab-b:~&lt;span class="nv"&gt;$ &lt;/span&gt;aws ec2 describe-volumes &lt;span class="se"&gt;\&lt;/span&gt;
 &lt;span class="nt"&gt;--region&lt;/span&gt; us-east-1 &lt;span class="se"&gt;\&lt;/span&gt;
 &lt;span class="nt"&gt;--filters&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="s2"&gt;"Name=attachment.instance-id,Values=&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;INSTANCE_ID&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="s2"&gt;"Name=tag:Name,Values=env-b-disk"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
 &lt;span class="nt"&gt;--query&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
   &lt;span class="s2"&gt;"Volumes[].Attachments[].[Device,VolumeId]"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
 &lt;span class="nt"&gt;--output&lt;/span&gt; json
&lt;span class="o"&gt;[&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt;
        &lt;span class="s2"&gt;"/dev/sdb"&lt;/span&gt;,
        &lt;span class="s2"&gt;"vol-034377a89c29ab66f"&lt;/span&gt;
    &lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Let's check if the device is available:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-b:~&lt;span class="nv"&gt;$ &lt;/span&gt;file /dev/sdb
/dev/sdb: cannot open &lt;span class="sb"&gt;`&lt;/span&gt;/dev/sdb&lt;span class="s1"&gt;' (No such file or directory)
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Nitro is much more advanced virtualization technology. As such, it exposes the volume ID of the device. I’ll use it to identify the EBS volume.&lt;/p&gt;

&lt;p&gt;I'll use &lt;code&gt;lsblk&lt;/code&gt; to list the serials of all connected block devices:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-b:~&lt;span class="nv"&gt;$ &lt;/span&gt;lsblk &lt;span class="nt"&gt;-o&lt;/span&gt; NAME,SERIAL
NAME        SERIAL
loop0
loop1
loop2
loop3
loop4
loop5
loop6
loop7
nvme1n1     vol034377a89c29ab66f
nvme0n1     vol02db41a568b8fe5cc
└─nvme0n1p1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As shown in the out of the awscli command, the volume ID of the disk is vol-034377a89c29ab66f. It matches nvme1n1. The device name generated by the kernel is: /dev/nvme1n1. Let's confirm it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-b:~&lt;span class="nv"&gt;$ &lt;/span&gt;file /dev/nvme1n1
/dev/nvme1n1: block special &lt;span class="o"&gt;(&lt;/span&gt;259/0&lt;span class="o"&gt;)&lt;/span&gt;
ubuntu@lab-b:~&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;fdisk &lt;span class="nt"&gt;-l&lt;/span&gt; /dev/nvme1n1
Disk /dev/nvme1n1: 10 GiB, 10737418240 bytes, 20971520 sectors
Disk model: Amazon Elastic Block Store
Units: sectors of 1 &lt;span class="k"&gt;*&lt;/span&gt; 512 &lt;span class="o"&gt;=&lt;/span&gt; 512 bytes
Sector size &lt;span class="o"&gt;(&lt;/span&gt;logical/physical&lt;span class="o"&gt;)&lt;/span&gt;: 512 bytes / 512 bytes
I/O size &lt;span class="o"&gt;(&lt;/span&gt;minimum/optimal&lt;span class="o"&gt;)&lt;/span&gt;: 512 bytes / 512 bytes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Common scenarios
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Automatically mount a device
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html"&gt;recommended way&lt;/a&gt; of referring to disks for automatic mount is to use the Universally unique identifier (UUID). It is unique for each formatted disk, and it doesn't change in time.&lt;/p&gt;

&lt;p&gt;The following code formats the EBS volume that I had previously identified in the &lt;code&gt;lab-a&lt;/code&gt; box and uses the resulting UUID to configure the &lt;code&gt;/etc/fstab&lt;/code&gt; file to automatically mount the device on each reboot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;mkfs &lt;span class="nt"&gt;-t&lt;/span&gt; xfs /dev/xvdb
ubuntu@lab-a&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;lsblk &lt;span class="nt"&gt;-o&lt;/span&gt; +UUID |grep xvdb
xvdb    202:16   0   10G  0 disk                             544ce0a9-ae55-4e03-b58a-eeacf2b6445f
ubuntu@lab-a&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir&lt;/span&gt; /disk
ubuntu@lab-a&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"UUID=544ce0a9-ae55-4e03-b58a-eeacf2b6445f  /disk  xfs  defaults,nofail  0  2"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /etc/fstab
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I ran the following command after restarting the box to confirm that everything was working:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a&lt;span class="nv"&gt;$ &lt;/span&gt;mount |grep disk
/dev/xvdb on /disk &lt;span class="nb"&gt;type &lt;/span&gt;xfs &lt;span class="o"&gt;(&lt;/span&gt;rw,relatime,attr2,inode64,logbufs&lt;span class="o"&gt;=&lt;/span&gt;8,logbsize&lt;span class="o"&gt;=&lt;/span&gt;32k,noquota&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Working with tools required the device name match the one provided by AWS
&lt;/h3&gt;

&lt;p&gt;You can create a symlink to the device as a workaround for tools not allowing to refer disks using the UUID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;ubuntu@lab-a&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /dev/xvdb /dev/sdb
ubuntu@lab-a&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-al&lt;/span&gt; /dev/sdb
lrwxrwxrwx 1 root root 9 Jul 22 19:36 /dev/sdb -&amp;gt; /dev/xvdb
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;My recommendation is to delete this symlink afterward to avoid any confusion in the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Hopefully, this article helped you gain a better understanding of how to use EBS volumes with Ubuntu. I used commands present of most Linux distributions, so if you are using any other distro this should work for you.&lt;/p&gt;

&lt;p&gt;If you are interested, here is a link to a highly recommended article on the evolution of the virtualization technology in Amazon:  &lt;a href="http://www.brendangregg.com/blog/2017-11-29/aws-ec2-virtualization-2017.html"&gt;AWS EC2 Virtualization 2017: Introducing Nitro&lt;/a&gt; by &lt;a href="https://twitter.com/brendangregg"&gt;Brendan Gregg&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>amazon</category>
      <category>ebs</category>
    </item>
  </channel>
</rss>
