forked from beginners-sameer/WorkShop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ExtendingEBSVolumeSize
69 lines (42 loc) · 1.79 KB
/
ExtendingEBSVolumeSize
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
1. Launch an EC2 instance with an extra volume having 10 gb size
# make the data volume available for us
1. Login to the instance and run the below command
sudo lsblk -f
2. To create a file system, run the below command
sudo mkfs -t xfs /dev/nvme1n1
3. To create a mount point directory for the data volume
sudo mkdir /data
4. To mount the data volume at the directory you just created
sudo mount /dev/nvme1n1 /data
5. To verify that you have formatted and mounted your data volume
lsblk -f
# Use the file -s command to get information about a specific device, such as its file system type. If the output shows simply data
sudo file -s /dev/xvdf
# Increase the size of the data volume
1. First create the snapshot
2. Modify the tutorials-volumes
3. Changge the size to 16 gb
# Extend the file system
1. Connect to the instance
2. df -hT // you wil see the same old file size
# run the below command to extend
sudo xfs_growfs -d /data
# use the below command to verify
df -hT
#Automatically mount an attached volume after reboot
sudo cp /etc/fstab /etc/fstab.orig
#get the UUID of the particular volume you want to..
Example:
[ec2-user@ip-10-0-3-1 ~]$ sudo blkid
/dev/xvda1: LABEL="/" UUID="44322bfa-376f-498c-9617-cd51e46a67d5" TYPE="xfs" PARTLABEL="Linux" PARTUUID="20ef60b6-8b9d-4cd2-b2fa-324392c4a4ef"
/dev/xvdb: UUID="cfb54a30-a749-4bb0-b05d-8c450c8f35a3" TYPE="xfs"
sudo vim /etc/fstab
UUID=aebf131c-6957-451e-8d34-ec978d9581ae /data xfs defaults,nofail 0 2
We specify 0 to prevent the file system from being dumped, and we specify 2 to indicate that it is a non-root device.
#Just unmount and mount it to verify
sudo umount /data
sudo mount -a
#If you receive an error mesage, we have to troubleshoot.
sudo mv /etc/fstab.orig /etc/fstab
#Clean-up
Delete a snapshot and Terminate an instance