{"id":755,"date":"2020-11-05T21:32:14","date_gmt":"2020-11-05T21:32:14","guid":{"rendered":"https:\/\/www.kolkataonweb.com\/code-bank\/?p=755"},"modified":"2020-11-05T21:32:16","modified_gmt":"2020-11-05T21:32:16","slug":"xfs-in-aws-ec2-for-mongodb-the-easy-way","status":"publish","type":"post","link":"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/xfs-in-aws-ec2-for-mongodb-the-easy-way\/","title":{"rendered":"XFS in AWS EC2 for MongoDB. The easy way"},"content":{"rendered":"\n<div class=\"wp-block-group alignwide\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<p>Changing the filesystem on AWS EC2 is a difficult task. The easy way to use XFS filesystem on AWS EC2 for hosting MongoDB is to add an extra block storage and format it as XFS<\/p>\n<\/div><\/div>\n\n\n\n<ul class=\"wp-block-list\"><li>First create a Block Storage and attach.<\/li><li>Provisioned IOPS SSD is a suitable one for high volume data flow.<\/li><li>Once the block storage is attached, then use the command prompt or terminal to format the disk as XFS and mount<ol><li>apt-get update<\/li><li>apt-get upgrade<\/li><li>lsblk    &#8212;-  <span style=\"color:#0070a0\" class=\"has-inline-color\">to view the attached block device and confirm<\/span><\/li><li>file -s \/dev\/nvme1n1  &#8212;  <span style=\"color:#0273a4\" class=\"has-inline-color\">to check if there is a filesystem already there or not. if there is no filesystem then it will return &#8220;device&#8221; <\/span>. <span style=\"color:#0075a7\" class=\"has-inline-color\">Else it will show something like this &#8220;\/dev\/nvme1n1: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)&#8221;<\/span>. <\/li><li>mkfs -t xfs \/dev\/nvme1n1    <span style=\"color:#006b9a\" class=\"has-inline-color\">&#8212;&#8211;  command to format the disk with XFS filesystem<\/span><\/li><li>apt-get install xfsprogs   &#8211;<span style=\"color:#0079ad\" class=\"has-inline-color\">&#8212; command to install xfs tools <\/span><\/li><li>mkdir \/mongodata<\/li><li>mount \/dev\/nvme1n1 \/data<\/li><li>mount \/dev\/nvme1n1 \/mongodatabases\/<\/li><li>cp \/etc\/fstab \/etc\/fstab.orig <\/li><li>blkid <span style=\"color:#006e9d\" class=\"has-inline-color\"> &#8212;&#8211;  to check the UUID of the block device added<\/span><\/li><li>nano \/etc\/fstab  <span style=\"color:#0072a4\" class=\"has-inline-color\">&#8212;&#8211; and add the device like this  UUID=7xxf03xx-6xxx-4xxx-9xxx-exxxxff2xxxxf \/mongodatabases xfs defaults,nofail 0 2<\/span><\/li><li>umount \/mongodatabases\/    <span style=\"color:#0075a7\" class=\"has-inline-color\">&#8212;&#8211;  unmount and  mount -a to check fstab entry<\/span><\/li><li>mount -a<\/li><li>reboot  <span style=\"color:#006f9f\" class=\"has-inline-color\">&#8212;  I did a double check by rebooting and checked if the disk is still attched and the mounted<\/span><\/li><li>df -h<\/li><li>lsblk<\/li><li>mount<\/li><\/ol><\/li><\/ul>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Changing the filesystem on AWS EC2 is a difficult task. The easy way to use XFS filesystem on AWS EC2 for hosting MongoDB is to add an extra block storage and format it as XFS First create a Block Storage and attach. Provisioned IOPS SSD is a suitable one for high volume data flow. Once&hellip; <a class=\"more-link\" href=\"https:\/\/www.kolkataonweb.com\/code-bank\/miscellaneous\/xfs-in-aws-ec2-for-mongodb-the-easy-way\/\">Continue reading <span class=\"screen-reader-text\">XFS in AWS EC2 for MongoDB. The easy way<\/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":[239,242,243,240,241],"class_list":["post-755","post","type-post","status-publish","format-standard","hentry","category-miscellaneous","tag-aws-ec2","tag-aws-xfs","tag-ec2-xfs","tag-mongodb","tag-mongodb-on-xfs","entry"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/755","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=755"}],"version-history":[{"count":1,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/755\/revisions"}],"predecessor-version":[{"id":756,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/posts\/755\/revisions\/756"}],"wp:attachment":[{"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/media?parent=755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/categories?post=755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kolkataonweb.com\/code-bank\/wp-json\/wp\/v2\/tags?post=755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}