Lab 4 3 Working with EBS - nicolas-tullio/Tech-Journal GitHub Wiki
Deliverables
Task 1 Screenshot of the Volume you created
Task 2: Screenshot showing attached volume
Task 4: Screenshot of cat command showing that you were able to create a file on the volume
Task 5: Screenshot showing completed snapshot
Task 6: Screenshot showing file from restored volume
Steps
Create a New EBS Volume
In the left navigation pane, choose Volumes
Create the following volume:
- Volume Type: General Purpose SSD (gp2)
- Size (GiB): 1. NOTE: You may be restricted from creating large volumes.
- Availability Zone: Select the same availability zone as your EC2 instance.
Choose Add tag
- In the Tag Editor, enter:
- Key: Name
- Value: My Volume
New Volume created
Attach the Volume to an Instance
Select My Volume then In the Actions menu, choose Attach volume
Choose the instance and device name
Volume is now In use
Connect to Lab instance
Create and Configure Your File System
Create an ext3 file system on the new volume:
sudo mkfs -t ext3 /dev/sdf
Create a directory for mounting the new storage volume:
sudo mkdir /mnt/data-store
Mount the new volume:
sudo mount /dev/sdf /mnt/data-store
- To configure the Linux instance to mount this volume whenever the instance is started, you will need to add a line to /etc/fstab. Run the command below to accomplish that:
echo "/dev/sdf /mnt/data-store ext3 defaults,noatime 1 2" | sudo tee -a /etc/fstab
View the available storage again:
df -h
On your mounted volume, create a file and add some text to it.
sudo sh -c "echo some text has been written > /mnt/data-store/file.txt"
Verify that the text has been written to your volume.
cat /mnt/data-store/file.txt
Create an Amazon EBS Snapshot
Select My Volume and In the Actions menu, select Create snapshot
Delete the file that you created on your volume and verify
sudo rm /mnt/data-store/file.txt
ls /mnt/data-store/
Restore the Amazon EBS Snapshot
My Snapshot > select Create volume from snapshot > Restored Volume
Volumes > Restored Volume > Actions menu, select Attach volume
Mount the Restored Volume
Create a directory for mounting the new storage volume:
sudo mkdir /mnt/data-store2
Mount the new volume:
sudo mount /dev/sdg /mnt/data-store2
Verify that volume you mounted has the file that you created earlier.
ls /mnt/data-store2/