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

I have a file tree in a directory. This is used to build bootable systems on hard drives and flash drives. I've also used it to build images for virtual machines. I would like to make an AWS AMI from it (plus whatever tweaks are needed to make it cloud worthy, like the cloud-init stuff). For now I am exploring how to make an EBS backed AMI. All the documentation and answered questions I have found focus on other ways to build AMIs, and involve using existing AMIs, or starting instances and saving what's in a running state. But I want to make something from scratch based on my system setup.

I envisioned a couple ways to do this based on what I can figure out from AWS documentation (nothing literally addresses by needs). In both cases I create a new volume and attach it to an instance running an arbitrary Linux AMI. In method A, in that instance I format the volume with ext4, mount it as /mnt/xvdf, then run rsync to upload my system file tree into the volume itself, and then unmount it. In method B, I create a loopback file on my home machine, format it, mount it, populate it from the system tree, unmount it, and and transmit the image file to the instance with the volume attached, and just copy the image to the volume device such much like dd. In both cases I would end up with a filesystem on the volume likes like I have on hard drives, flash drives, and VM image files (raw).

Then I make a snapshot of that volume and register it as an AMI. But it does not work. The error obtained from the instance log is that the kernel panicked because the filesystem type could not be mounted (has an unsupported feature).

Am i basically doing the right process and just goofed up a step (like formatting a filesystem type it doesn't like ... I am using ext4)?

Or am I doing it wrong? It did get far enough that it let me register the AMI, and launch an instance from it.

I'm sure I need to make many tweaks to the file tree to get it to work right in the cloud environment. I will be learning what those are. But right now it has not gotten far enough to even consider whether my files are right or wrong.

Please don't suggest for me to try making an S3-backed AMI or make one from a running instance. I do plan to try those methods as part of learning everything, but those are later. This is now and the goal is to make an AMI from an unbooted scratch image/tree (which works in other places).

share|improve this question
    
What Linux distro are you building? –  Eric Hammond Jul 25 '12 at 0:05
    
My own. More than one. –  Skaperen Jul 25 '12 at 1:48
    
Building an AMI from scratch is a pretty daunting project as there are a number of hoops to jump through and traps to fall into. Plus, you get very little feedback in the form of errors when it fails to start. I did this for 2 years for Ubuntu AMIs. I now start with a copy of the Ubuntu file system created by Canonical where they have applied all of the changes needed for EC2, and then I make my custom changes and copy the results to an EBS volume as you describe. –  Eric Hammond Jul 25 '12 at 4:10
    
I actually tried the Ubuntu 12.04 AMI. copied it into a local file tree, then performed the steps I described with it. I got that error with Ubuntu, too. So how did Ubuntu build an EBS AMI? What did they do once they had a system image/tree ready to go? Yes, I anticipate I need to put "stuff" into the system for the cloud environment. But even with that, I need to learn the steps from the built system to the AMI. –  Skaperen Jul 25 '12 at 5:38
    
So should I just use instance-store backed AMIs? –  Skaperen Jul 25 '12 at 17:33

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.