Last active
August 29, 2015 14:11
-
-
Save ringods/d02d07909d9c8a5edebd to your computer and use it in GitHub Desktop.
Sharing EBS Volumes Among Instances
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
# ls /mnt | |
data-store lost+found | |
# ls /mnt/data-store/ | |
lost+found |
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
$ ec2-detach-volume vol-4001e429 -i i-5a12b233 | |
ATTACHMENT vol-4001e429 i-5a12b233 /dev/sdh detaching 2008-09-25T11:25:46+0000 | |
$ ec2-describe-volumes | |
VOLUME vol-4001e429 1 us-east-1c available 2008-09-25T09:51:48+0000 | |
$ ec2-terminate-instances i-5a12b233 | |
INSTANCE i-5a12b233 running shutting-down | |
$ ec2-describe-instances | |
RESERVATION r-eb22f182 190912652296 default | |
INSTANCE i-5a12b233 ami-c6c622af ec2-72-44-53-70.compute-1.amazonaws.com domU-12-31-39-01-5C-76.compute-1.internal shutting-down gettingstarted-keypair 0 m1.small 2008-09-25T11:23:01+0000 us-east-1c | |
$ ec2-describe-instances | |
RESERVATION r-eb22f182 190912652296 default | |
INSTANCE i-5a12b233 ami-c6c622af terminated gettingstarted-keypair 0 m1.small 2008-09-25T11:23:01+0000 |
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
$ ssh -i id_rsa-gettingstarted-keypair [email protected] |
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
This is an example file to show that a file persists on an EBS volume after unmounting and detaching. |
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
$ ec2-detach-volume vol-4001e429 -i i-520faf3b -d /dev/sdh | |
ATTACHMENT vol-4001e429 i-520faf3b /dev/sdh detaching 2008-09-25T09:59:14+0000 |
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
# ls /dev | |
MAKEDEV port ptyc1 ptye6 ptyqb ptyt0 ptyv5 ptyxa ptyzf ttya2 ttyc7 ttyec ttyr1 ttyt6 ttyvb ttyy0 | |
--- cut here for brevity --- | |
loop7 ptyb3 ptyd8 ptypd ptys2 ptyu7 ptywc ptyz1 sdh ttyb9 ttyde ttyq3 ttys8 ttyud ttyx2 ttyz7 | |
--- cut here for brevity --- |
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
$ ec2-attach-volume vol-4001e429 -i i-520faf3b -d /dev/sdh | |
ATTACHMENT vol-4001e429 i-520faf3b /dev/sdh attaching 2008-09-25T09:59:14+0000 |
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
$ ec2-create-volume --size 1 -z us-east-1c | |
VOLUME vol-4001e429 1 us-east-1c creating 2008-09-25T09:51:48+0000 |
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
$ ec2-describe-images -o self | |
IMAGE ami-c6c622af dehonk-gettingstarted/image.manifest.xml 190912652296 available private i386 machine |
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
$ ec2-describe-instances | |
RESERVATION r-9f3deef6 190912652296 default | |
INSTANCE i-520faf3b ami-c6c622af pending gettingstarted-keypair 0 m1.small 2008-09-25T09:50:01+0000 us-east-1c |
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
$ ec2-describe-volumes | |
VOLUME vol-4001e429 1 us-east-1c in-use 2008-09-25T09:51:48+0000 ATTACHMENT vol-4001e429 i-520faf3b /dev/sdh attached 2008-09-25T09:59:14+0000 |
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
$ ec2-describe-volumes | |
VOLUME vol-4001e429 1 us-east-1c available 2008-09-25T09:51:48+0000 |
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
$ ec2-describe-volumes vol-4001e429 | |
VOLUME vol-4001e429 1 us-east-1c available 2008-09-25T09:51:48+0000 |
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
# yes | mkfs -t ext3 /dev/sdh | |
mke2fs 1.38 (30-Jun-2005) | |
/dev/sdh is entire device, not just one partition! | |
Proceed anyway? (y,n) Filesystem label= | |
OS type: Linux | |
Block size=4096 (log=2) | |
Fragment size=4096 (log=2) | |
131072 inodes, 262144 blocks | |
13107 blocks (5.00%) reserved for the super user | |
First data block=0 | |
Maximum filesystem blocks=268435456 | |
8 block groups | |
32768 blocks per group, 32768 fragments per group | |
16384 inodes per group | |
Superblock backups stored on blocks: | |
32768, 98304, 163840, 229376 | |
Writing inode tables: done | |
Creating journal (8192 blocks): done | |
Writing superblocks and filesystem accounting information: done | |
This filesystem will be automatically checked every 20 mounts or | |
180 days, whichever comes first. Use tune2fs -c or -i to override. |
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
$ ec2-run-instances ami-c6c622af -k gettingstarted-keypair -z us-east-1c | |
RESERVATION r-eb22f182 190912652296 default | |
INSTANCE i-5a12b233 ami-c6c622af pending gettingstarted-keypair 0 m1.small 2008-09-25T11:23:01+0000 us-east-1c | |
$ ec2-describe-instances | |
RESERVATION r-eb22f182 190912652296 default | |
INSTANCE i-5a12b233 ami-c6c622af ec2-72-44-53-70.compute-1.amazonaws.com domU-12-31-39-01-5C-76.compute-1.internal running gettingstarted-keypair 0 m1.small 2008-09-25T11:23:01+0000 us-east-1c | |
$ ec2-describe-volumes | |
VOLUME vol-4001e429 1 us-east-1c available 2008-09-25T09:51:48+0000 | |
$ ec2-attach-volume vol-4001e429 -i i-5a12b233 -d /dev/sdh | |
ATTACHMENT vol-4001e429 i-5a12b233 /dev/sdh attaching 2008-09-25T11:25:46+0000 | |
$ ec2-describe-volumes | |
VOLUME vol-4001e429 1 us-east-1c in-use 2008-09-25T09:51:48+0000 | |
ATTACHMENT vol-4001e429 i-5a12b233 /dev/sdh attached 2008-09-25T11:25:46+0000 |
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
$ ssh -i id_rsa-gettingstarted-keypair [email protected] | |
Last login: Tue Sep 9 14:48:20 2008 from 213.49.236.209 | |
__| __|_ ) Rev: 2 | |
_| ( / | |
___|\___|___| | |
Welcome to an EC2 Public Image | |
Getting Started | |
__ c __ /etc/ec2/release-notes.txt | |
[root@domU-12-31-39-01-5C-76 ~]# mkdir /mnt/data-store | |
[root@domU-12-31-39-01-5C-76 ~]# mount /dev/sdh /mnt/data-store | |
[root@domU-12-31-39-01-5C-76 ~]# cd /mnt/data-store | |
[root@domU-12-31-39-01-5C-76 data-store]# ls | |
lost+found readme | |
[root@domU-12-31-39-01-5C-76 data-store]# cat readme | |
This is an example file to show that a file persists on an EBS volume after unmounting and detaching. | |
[root@domU-12-31-39-01-5C-76 ~]# umount /mnt/data-store | |
[root@domU-12-31-39-01-5C-76 ~]# exit |
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
# mkdir /mnt/data-store | |
# mount /dev/sdh /mnt/data-store |
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
# umount /mnt/data-store |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment