First create a volume you want to attach
Now attach this volume to your EC2 server
Now logging in to your linux EC2 server and run the below command
[root@ip-172-31-88-83 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part / -----This is root volume
xvdf 202:80 0 1G 0 disk ------This is our additional volume which are not mount till now
If the output shows simply
[root@ip-172-31-88-83 ~]# sudo file -s /dev/xvdf
/dev/xvdf: data
Use the mkfs -t command to create a file system on the volume.
[root@ip-172-31-88-83 ~]# sudo mkfs -t xfs /dev/xvdf
meta-data=/dev/xvdf isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Use the mkdir command to create a mount point directory for the volume
[root@ip-172-31-88-83 ~]# sudo mkdir /data
Use the following command to mount the volume at the directory you created in the previous step.
[root@ip-172-31-88-83 ~]# sudo mount /dev/xvdf /data
Now our Volume are mount and ready for use to write to the volume
[root@ip-172-31-88-83 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part /
xvdf 202:80 0 1G 0 disk /data
Now attach this volume to your EC2 server
Now logging in to your linux EC2 server and run the below command
[root@ip-172-31-88-83 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part / -----This is root volume
xvdf 202:80 0 1G 0 disk ------This is our additional volume which are not mount till now
If the output shows simply
data, as in the following example output, there is no file system on the device and you must create one.[root@ip-172-31-88-83 ~]# sudo file -s /dev/xvdf
/dev/xvdf: data
Use the mkfs -t command to create a file system on the volume.
[root@ip-172-31-88-83 ~]# sudo mkfs -t xfs /dev/xvdf
meta-data=/dev/xvdf isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=0
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
Use the mkdir command to create a mount point directory for the volume
[root@ip-172-31-88-83 ~]# sudo mkdir /data
Use the following command to mount the volume at the directory you created in the previous step.
[root@ip-172-31-88-83 ~]# sudo mount /dev/xvdf /data
Now our Volume are mount and ready for use to write to the volume
[root@ip-172-31-88-83 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 8G 0 disk
└─xvda1 202:1 0 8G 0 part /
xvdf 202:80 0 1G 0 disk /data


No comments:
Post a Comment