Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm in the process of creating a number of Amazon Machine Images (AMIs) that will be uploaded and run on the basis of our Xen images. However, I'm running into problems with some platforms where the drive names assigned when they are running on EC2 are different than what Xen names them when we run the images locally.

For example, under SUSE running locally we see the following:

brw-rw---- 1 root disk 202, 1 Jan 30 07:49 xvda1
brw-rw---- 1 root disk 202, 2 Jan 30 07:49 xvda2
brw-rw---- 1 root disk 202, 3 Jan 30 07:49 xvda3

While the Amazon supplied images report the following when running on a t1.micro:

brw-rw---- 1 root disk 8, 1 Jan 30 13:18 sda1

How can I prepare my Xen images so that when we bundle them using ec2-bundle-image the correct disk name will be automatically selected?

share|improve this question

1 Answer 1

The best approach is to not refer to drives by the actual names, but rather by the filesystem UUIDs or labels. These are exposed in /dev/disk/by-uuid and /dev/disk/by-label respectively, and can be specified in /etc/fstab with the UUID= or LABEL= syntax:

UUID=e6c4e981-ce1d-423e-9f23-167f8b370021   /   ext4    defaults    0   0

This is also accepted for the root= kernel parameter configured in the bootloader, so using GRUB1 for example:

kernel  /vmlinuz-3.2.0-31-virtual root=UUID=e6c4e981-ce1d-423e-9f23-167f8b370021 ro

GRUB2 and some patched versions of GRUB1 support UUIDs for finding the partition containing /boot. This shouldn't be a problem however since bootloaders don't name virtual disks differently.

share|improve this answer
Would this also work at boot time though? We ran into an issue with the menu.lst file referring to /dev/xvda1 and causing the virtual machine to hang because it was /dev/sda1/ –  rob Feb 1 '13 at 3:57
@RobZ Edited answer. –  mgorven Feb 1 '13 at 17:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.