Tag Archives: additional disk on ec2

Adding a second disk and quota in Amazon EC2

This article is based on Ubuntu 20.04.

AWS has good documentation on how to create and add the disk to the instance so not mentioning those steps here.

Once the disk is added to the system verify that it is added and what is the name it is being shown as.

Steps for adding the disk to the system – that is making it ready for mounting

  1. lsblk  --- to check the disk has been added and the name
  2. mkfs -t ext4 /dev/<disk name>    --- Please Note - xfs disks gives error when quota options are added in the fstab files. e.g - mkfs -t ext4 /dev/nvme1n1
  3. mount /dev/<disk name> <mount point>  ---  e.g - mount /dev/nvme1n1 /data
  4. blkid --- check the UUID of the disk
  5. Add entry to fstab
    
    UUID=axxf131c-xxxx-xxxx-8xxx-ec978dxxxxxx /data ext4 defaults,nofail 0 2
    
    Replace /data with your mount point name
    
    nofail will ensure that the system boots even if the disk mounting fails (like when disk removed)
  6. umount <mount point>  ---  umount /data
  7. mount -a  --- Please note - wrong entry in the fstab can make the system unbootable. So please ensure that there are no errors. And don't reboot without resolving errors.  

 

Now the steps for turning on Quota

  1. mount -o remount <disk partition>  e.g - mount -o remount /data
  2. quotacheck -avugm
  3. quotaon -avug
  4. Edit the fstab file and add the necessary
    • nano /etc/fstab
    • add the following to the end of the existing parameters ,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0
    • Save the file
    • Please note - wrong entry in the fstab file can make the system unusable. Please check the file first before rebooting.  Use mount -a to check if the entries in fstab file is good.

Example: