Friday 2 October 2020

attach mount point to EBS volume using script

 #!/bin/bash

#attach the EBS drive from the console to /dev/sdf


#list the volumes

lslbk

#check if the volume has any data

sudo file -s /dev/xvdf

#format the volume as ext4

sudo mkfs -t ext4 /dev/xvdf

#create a directory

sudo mkdir /myexternalvolume

#mount our EBS to our directory

sudo mount /dev/xvdf  /myexternalvolume



output for the above script:






# with the above process the mount point will save temporarily, To save new mount point changes permanently. edit fstab file.

sudo nano /etc/fstab

 manually activity:

/dev/xvdf    /myexternalvolume  ext4 defaults,nofail    0   0 



press ESC 
:wq!


cat /etc/fstab --> check our new entry.



No comments:

Post a Comment