سؤال

I've just set up an Amazon EC2 instance (ubuntu) for the first time, and I'm failing to understand something pretty basic.

I thought that the only parts of the filesystem that persist across reboots (or start/stop) are the volumes that you create and then attach and mount. So I created such a volume, and attached it and mounted it, which worked fine. But something funny happened along the way. I followed these instructions, which told me to create an entry in /etc/fstab, which will be used for evermore to mount the volume whenever I reboot. So /etc/fstab persists also, right?

And if it does, then what else does? I'd like to do things such as change the .bash-profile in my home directory (or change my home directory to sit on the volume I created, and then change the .bash-profile there, if that helps) -- but before I attempt these things I need to know which parts of the filesystem are going to hang around.

هل كانت مفيدة؟

المحلول

First off, there is a difference between a reboot and a stop followed by a start - things always persist across reboots.

After that it depends on the volume type. Instance store volumes do not persist across stop/start, but EBS volumes do. EBS volumes will hang around after an instance is terminated too, unless the destroy on termination flag is set.

Whether your root volume is EBS or instance store depends on the AMI you started the instance with. Amazon do seem to have been encouraging people to use EBS.

نصائح أخرى

By default for most amazon instances, the root disk IS an ebs volume (8 GB or so). If you dig around, you'll probably find the Instance Store is mounted under /mnt/is (80-160 GB or so). So, /etc/fstab is persisted because it is stored on an ebs volume.

If you want more storage (ie to run a database), then you would create a new (second) ebs volume and add it to fstab somewhere (ie /var/sql). Both ebs volumes will be attached. In the web interface you can find both of these volumes and what their drive letter is.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top