Last active
December 19, 2015 02:48
-
-
Save fforbeck/5885172 to your computer and use it in GitHub Desktop.
Add EBS to Ubuntu EC2 Instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You need to format the EBS volume (block device) with a file system between step 1 and step 2. So the entire process with your sample mount point is: | |
| Create EBS volume. | |
| Attach EBS volume to /dev/sdf (EC2's external name for this particular device number). | |
| Format file system /dev/xvdf (Ubuntu's internal name for this particular device number): | |
| sudo mkfs.ext4 /dev/xvdf | |
| Mount file system (with update to /etc/fstab so it stays mounted on reboot): | |
| sudo mkdir -m 000 /vol | |
| echo "/dev/xvdf /vol auto noatime 0 0" | sudo tee -a /etc/fstab | |
| sudo mount /vol | |
| move your data to the new volume, then create a symbolic link from the old path to the data in the new volume. | |
| # -m 000 | |
| #Turning off all bits in the mode is a simple indicator that nobody should be allowed to do anything in this directory until a #new file system is mounted here. It's a message that this directory has been created as a mount point. It is not required for #functionality, but sometimes avoids the mistakes of creating files when the desired volume is not mounted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ grep swap /etc/fstab | |
| UUID=x none swap sw 0 0 | |
| $ swapon -s | |
| Filename Type Size Used Priority | |
| /dev/x partition 0 111 -1 | |
| $ sudo fdisk -l /dev/x | |
| /dev/X 111 11 1111 11 Linux swap / Solaris | |
| $ sudo mkswap /dev/x | |
| $ sudo swapon /dev/x | |
| /etc/fstab | |
| /dev/x none swap sw 0 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment