How to use "Instance Store Volumes" storage in Amazon EC2?
Solution 1:
If it's not already mounted under e.g. /mnt and if it doesn't have a filesystem created already then do:
Check the device name
sudo fdisk -l
Make directory to where you want to mount the volume
sudo mkdir /mnt
Create filesystem on your volume (make sure you choose the correct volume because this creates a new file system on the volume)
sudo mkfs.ext4 /dev/xvdj
Mount volume
sudo mount -t ext4 /dev/xvdj /mnt
If you want to preserve the mount after e.g. a restart, open /etc/fstab and add the mount to it
echo "/dev/xvdj /mnt auto noatime 0 0" | sudo tee -a /etc/fstab
Make sure nothing is wrong with fstab by mounting all
mount -a
Solution 2:
The use of instance-local storage that is not persistent when an instance is stopped is pretty simple: It's a very large chunk of space useful for transient things. They're the perfect target for mounting to /tmp
, and is extremely useful if your server handles very large files transiently.
For example, if you were building a group of instances to do voice-to-text translation of uploaded video-files, instance-local storage would be just the thing you want to put the in-process files on. It may be there for a few hours while the file is processed, but once it's done it can be deleted and another one taken up. You don't need EBS for that, and it's a lot cheaper to run that kind of storage out of instance-local rather than EBS.
Instance-local storage is meant to be used as scratch-space for running processing, not long-term storage. If your workload doesn't use scratch-space for anything, or what it needs is so small as to not be significant, then it isn't a good fit for you.