{"id":765,"date":"2021-01-08T21:37:38","date_gmt":"2021-01-08T21:37:38","guid":{"rendered":"https:\/\/www.kolkataonweb.com\/code-bank\/?p=765"},"modified":"2021-01-06T23:21:24","modified_gmt":"2021-01-06T23:21:24","slug":"adding-a-second-disk-and-quota-in-amazon-ec2","status":"publish","type":"post","link":"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/adding-a-second-disk-and-quota-in-amazon-ec2\/","title":{"rendered":"Adding a second disk and quota in Amazon EC2"},"content":{"rendered":"<p>This article is based on Ubuntu 20.04.<\/p>\n<p>AWS has good documentation on how to create and add the disk to the instance so not mentioning those steps here.<\/p>\n<p>Once the disk is added to the system verify that it is added and what is the name it is being shown as.<\/p>\n<p><strong>Steps for adding the disk to the system &#8211; that is making it ready for mounting<\/strong><\/p>\n<ol>\n<li>\n<pre class='wp-code-highlight prettyprint'>lsblk\u00a0<span style=\"color: #808080;\"> <em>--- to check the disk has been added and the name<\/em><\/span><\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>mkfs -t ext4 \/dev\/&lt;disk name&gt; \u00a0<span style=\"color: #ff8080;\">\u00a0<em> --- Please Note - xfs disks gives error when quota options are added in the fstab files. e.g - mkfs -t ext4 \/dev\/nvme1n1<\/em><\/span><\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>mount \/dev\/&lt;disk name&gt; &lt;mount point&gt;\u00a0<span style=\"color: #808080;\"> <em>---\u00a0 e.g - mount \/dev\/nvme1n1 \/data<\/em><\/span><\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>blkid<span style=\"color: #808080;\"> <em>--- check the UUID of the disk<\/em><\/span><\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>Add entry to fstab\r\n\r\nUUID=axxf131c-xxxx-xxxx-8xxx-ec978dxxxxxx <span style=\"color: #ff6600;\">\/data<\/span> ext4 defaults,<span style=\"color: #ff6600;\">nofail<\/span> 0 2\r\n\r\n<span style=\"color: #808080;\"><em>Replace \/data with your mount point name<\/em><\/span>\r\n\r\n<span style=\"color: #808080;\"><em>nofail will ensure that the system boots even if the disk mounting fails (like when disk removed)<\/em><\/span><\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>umount &lt;mount point&gt;\u00a0 <span style=\"color: #808080;\"><em>---\u00a0 umount \/data<\/em><\/span><\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>mount -a\u00a0<span style=\"color: #ff8080;\"> <em>--- 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.\u00a0<\/em> <\/span><\/pre>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><strong>Now the steps for turning on Quota<\/strong><\/p>\n<ol>\n<li>\n<pre class='wp-code-highlight prettyprint'>mount -o remount &lt;disk partition&gt;\u00a0 e.g - mount -o remount \/data<\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>quotacheck -avugm<\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>quotaon -avug<\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>Edit the fstab file and add the necessary<\/pre>\n<ul>\n<li>\n<pre class='wp-code-highlight prettyprint'>nano \/etc\/fstab<\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>add the following to the end of the existing parameters <em>,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0<\/em><\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>Save the file<\/pre>\n<\/li>\n<li>\n<pre class='wp-code-highlight prettyprint'>Please note - wrong entry in the fstab file can make the system unusable. Please check the file first before rebooting.\u00a0 Use <em>mount -a <\/em>to check if the entries in fstab file is good.<\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<p>Example:<\/p>\n<p><a href=\"https:\/\/www.kolkataonweb.com\/code-bank\/wp-content\/uploads\/2021\/01\/Fstab-example-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-767 size-full\" src=\"https:\/\/www.kolkataonweb.com\/code-bank\/wp-content\/uploads\/2021\/01\/Fstab-example-1.png\" alt=\"\" width=\"1053\" height=\"80\" srcset=\"https:\/\/www.kolkataonweb.com\/code-bank\/wp-content\/uploads\/2021\/01\/Fstab-example-1.png 1053w, https:\/\/www.kolkataonweb.com\/code-bank\/wp-content\/uploads\/2021\/01\/Fstab-example-1-300x23.png 300w, https:\/\/www.kolkataonweb.com\/code-bank\/wp-content\/uploads\/2021\/01\/Fstab-example-1-1024x78.png 1024w, https:\/\/www.kolkataonweb.com\/code-bank\/wp-content\/uploads\/2021\/01\/Fstab-example-1-768x58.png 768w\" sizes=\"auto, (max-width: 1053px) 100vw, 1053px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&hellip; <a class=\"more-link\" href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/adding-a-second-disk-and-quota-in-amazon-ec2\/\">Continue reading <span class=\"screen-reader-text\">Adding a second disk and quota in Amazon EC2<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[250,249,253,252,247,246,251,254],"class_list":["post-765","post","type-post","status-publish","format-standard","hentry","category-miscellaneous","tag-add-disk-on-amazon-ec2","tag-add-disk-on-ec2","tag-additional-disk-on-amazon-ec2","tag-additional-disk-on-ec2","tag-disk-quota-on-amazon-ec2","tag-disk-quota-on-aws-ec2","tag-fstab","tag-quota-on-additional-disk","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/765","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/comments?post=765"}],"version-history":[{"count":3,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/765\/revisions"}],"predecessor-version":[{"id":770,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/765\/revisions\/770"}],"wp:attachment":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/media?parent=765"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/categories?post=765"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/tags?post=765"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}