{"id":3977,"date":"2022-09-14T16:19:46","date_gmt":"2022-09-14T16:19:46","guid":{"rendered":"https:\/\/www.gubatron.com\/blog\/?p=3977"},"modified":"2026-04-01T05:10:50","modified_gmt":"2026-04-01T05:10:50","slug":"how-to-resize-aws-ec2-ebs-root-partition-without-rebooting-in-3-steps","status":"publish","type":"post","link":"https:\/\/www.gubatron.com\/blog\/how-to-resize-aws-ec2-ebs-root-partition-without-rebooting-in-3-steps\/","title":{"rendered":"How to resize AWS ec2 ebs root partition without rebooting in 3 steps"},"content":{"rendered":"<p>Go to the AWS EBS dashboard and modify the volume size. Might be good to create a snapshot of it for safety but haven&#8217;t really failed ever doing this.<\/p>\n<pre># 1. Check the device of your partition\n<strong>$ sudo lsblk<\/strong>\nNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS\nloop0 7:0 0 28.1M 1 loop \/snap\/amazon-ssm-agent\/2012\nloop1 7:1 0 97M 1 loop \/snap\/core\/9665\nloop2 7:2 0 55M 1 loop \/snap\/core18\/1880\nloop3 7:3 0 71.3M 1 loop \/snap\/lxd\/16100\nxvda 202:0 0 25G 0 disk\n\u2514\u2500xvda1 202:1 0 20G 0 part \/\nxvdf 202:80 0 1T 0 disk \/mnt\/ebs\/frostwire-files\nxvdg 202:96 0 16G 0 disk \/mnt\/ebs\/oldroot<\/pre>\n<pre># 1.1 Check also the partition type (xfs, ext2, ext4) and UUID\n$ sudo lsblk -f\nNAME    FSTYPE FSVER LABEL           UUID                                 FSAVAIL FSUSE% MOUNTPOINTS\nloop0                                                                           0   100% \/snap\/amazon-ssm-agent\/2012\nloop1                                                                           0   100% \/snap\/core\/9665\nloop2                                                                           0   100% \/snap\/core18\/1880\nloop3                                                                           0   100% \/snap\/lxd\/16100\nxvda                                                                                     \n\u2514\u2500xvda1 ext4   1.0   cloudimg-rootfs 9451d968-8716-47ca-84d5-68b5c79f61e8    6.7G    72% \/\nxvdb    xfs                          689cc5cc-1c86-4e21-9852-263bce6e6cbd                \nxvdf    xfs                          9b9aea95-f962-43eb-ba5b-1a41b6ad2b71  955.1G     7% \/mnt\/ebs\/frostwire-files\nxvdg    ext4   1.0   cloudimg-rootfs 01434116-df17-4d4d-8195-f10cc1252f8f    6.2G    56% \/mnt\/ebs\/oldroot<\/pre>\n<p>&nbsp;<\/p>\n<pre># 2. Grow the partition\n<strong>$ sudo growpart \/dev\/xvda 1<\/strong>\nCHANGED: partition=1 start=2048 old: size=41940959 end=41943007 new: size=52426719 end=52428767\n\n# 3. Extend the file system\n<strong>$ sudo resize2fs \/dev\/xvda1<\/strong>\nresize2fs 1.46.5 (30-Dec-2021)\nFilesystem at \/dev\/xvda1 is mounted on \/; on-line resizing required\nold_desc_blocks = 3, new_desc_blocks = 4\n...\n\n# Done, new size is reflected with df\n$ df -h\nFilesystem Size Used Avail Use% Mounted on\n\/dev\/root 25G 19G 5.6G 78% \/<\/pre>\n<p>&nbsp;<\/p>\n<p>Troubleshooting <code>growpart<\/code><\/p>\n<pre>$ sudo growpart \/dev\/nvme1n1 1\nWARN: unknown label \nfailed [sfd_dump:1] sfdisk --unit=S --dump \/dev\/nvme1n1\nsfdisk: \/dev\/nvme1n1: does not contain a recognized partition table\nFAILED: failed to dump sfdisk info for \/dev\/nvme1n1\n<\/pre>\n<p>This can happen if your partition is an xfs partition, in that case try the following to double check:<\/p>\n<pre>lsblk -f \/dev\/nvme1n1\nNAME    FSTYPE FSVER LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINTS\nnvme1n1 xfs                5615a816-53bc-4090-a537-80ba86b1b5f3   49.9G    75% \/media\/ebs\/data\n<\/pre>\n<p>We see it&#8217;s an XFS filesystem, therefore we can do this now:<\/p>\n<pre>sudo xfs_growfs \/dev\/nvme1n1\nmeta-data=\/dev\/nvme1n1           isize=256    agcount=50, agsize=1310720 blks\n         =                       sectsz=512   attr=2, projid32bit=0\n         =                       crc=0        finobt=0, sparse=0, rmapbt=0\n         =                       reflink=0    bigtime=0 inobtcount=0\ndata     =                       bsize=4096   blocks=65536000, imaxpct=25\n         =                       sunit=0      swidth=0 blks\nnaming   =version 2              bsize=4096   ascii-ci=0, ftype=0\nlog      =internal log           bsize=4096   blocks=2560, version=2\n         =                       sectsz=512   sunit=0 blks, lazy-count=1\nrealtime =none                   extsz=4096   blocks=0, rtextents=0\n<\/pre>\n<p>We should now see the changes in df -h<\/p>\n<pre>df -h\nFilesystem       Size  Used Avail Use% Mounted on\n...\n\/dev\/nvme1n1     250G  151G  100G  61% \/media\/ebs\/data\n...\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Go to the AWS EBS dashboard and modify the volume size. Might be good to create a snapshot of it for safety but haven&#8217;t really failed ever doing this. # 1. Check the device of your partition $ sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS loop0 7:0 0 28.1M 1 loop \/snap\/amazon-ssm-agent\/2012 loop1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":4189,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[15],"tags":[],"class_list":["post-3977","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2022\/09\/xai-tmp-imgen-db8aab31-34e5-4be7-b882-a7e87a2836f9.jpg?fit=1091%2C655&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5Unzf-129","jetpack-related-posts":[{"id":3127,"url":"https:\/\/www.gubatron.com\/blog\/cant-ssh-to-ec2-ubuntu-instance-etcfstab-breaks-bootup-due-to-missing-ebs-volume-solved\/","url_meta":{"origin":3977,"position":0},"title":"can&#8217;t ssh to ec2 ubuntu instance, \/etc\/fstab breaks bootup due to missing ebs volume [SOLVED]","author":"gubatron","date":"August 21, 2013","format":false,"excerpt":"So the \/etc\/fstab file on your root volume looked like this LABEL=cloudimg-rootfs \/ ext4 defaults 0 0 \/dev\/xvdf \/mnt\/backups auto defaults,comment=cloudconfig 0 2 by mistake you deleted the ebs volume that you had mounted on \/mnt\/backups (or whatever folder) and you restarted your ubuntu instance not knowing that if the\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3213,"url":"https:\/\/www.gubatron.com\/blog\/aws-troubleshooting-how-to-fix-a-broken-ebs-volume-bad-superblock-on-xfs\/","url_meta":{"origin":3977,"position":1},"title":"AWS troubleshooting: how to fix a broken EBS volume (bad superblock on xfs)","author":"gubatron","date":"January 19, 2014","format":false,"excerpt":"As great as EBS volumes are on Amazon Web Services, they can break and not ever mount again, even though your data could still be there intact, a simple corruption on the filesystem structure can cause a lot of damage. On this post I teach you how to move all\u2026","rel":"","context":"In &quot;Geeklife&quot;","block_context":{"text":"Geeklife","link":"https:\/\/www.gubatron.com\/blog\/category\/geeklife\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/01\/car-longshot2.jpg?fit=720%2C482&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/01\/car-longshot2.jpg?fit=720%2C482&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/01\/car-longshot2.jpg?fit=720%2C482&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/01\/car-longshot2.jpg?fit=720%2C482&ssl=1&resize=700%2C400 2x"},"classes":[]},{"id":3370,"url":"https:\/\/www.gubatron.com\/blog\/how-to-resize-an-ebs-xfs-formatted-partition\/","url_meta":{"origin":3977,"position":2},"title":"How to resize an EBS (xfs formatted) partition","author":"gubatron","date":"December 20, 2014","format":false,"excerpt":"First of all, create a snapshot of your EBS volume. Then out of that snapshot you will be able to create your new volume. However, when you detach the old one from your instance and attach the new one, you will still see the old available space with df look\u2026","rel":"","context":"In &quot;Code&quot;","block_context":{"text":"Code","link":"https:\/\/www.gubatron.com\/blog\/category\/code\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2016-01-02-at-4.42.45-PM.png?fit=1200%2C420&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2016-01-02-at-4.42.45-PM.png?fit=1200%2C420&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2016-01-02-at-4.42.45-PM.png?fit=1200%2C420&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2016-01-02-at-4.42.45-PM.png?fit=1200%2C420&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/www.gubatron.com\/blog\/wp-content\/uploads\/2014\/12\/Screen-Shot-2016-01-02-at-4.42.45-PM.png?fit=1200%2C420&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":2734,"url":"https:\/\/www.gubatron.com\/blog\/sample-etcfstab-entry-for-ebs-volume\/","url_meta":{"origin":3977,"position":3},"title":"Sample \/etc\/fstab entry for EBS volume","author":"gubatron","date":"May 23, 2012","format":false,"excerpt":"gid= and uid= are not valid for XFS, pass \"grpid=\" to your fstab entry. \/dev\/xvdf \/media\/ebs\/data xfs defaults,auto,noatime,noexec,grpid=1000 0 0","rel":"","context":"In \"aws\"","block_context":{"text":"aws","link":"https:\/\/www.gubatron.com\/blog\/tag\/aws\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1092,"url":"https:\/\/www.gubatron.com\/blog\/preparing-your-primary-mount-and-swap-with-fdisk\/","url_meta":{"origin":3977,"position":4},"title":"Preparing your primary mount and swap with fdisk","author":"gubatron","date":"January 10, 2009","format":false,"excerpt":"I have 4 big drives on a new machine, each can hold up to 2Tb of data, at first I thought I'd use the first drive for the OS and the other 3 for a RAID5 (software controlled) Then after I had installed the operating system, I decided it was\u2026","rel":"","context":"In &quot;Geeklife&quot;","block_context":{"text":"Geeklife","link":"https:\/\/www.gubatron.com\/blog\/category\/geeklife\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2745,"url":"https:\/\/www.gubatron.com\/blog\/ubuntu-mongodb-wont-start-fixed\/","url_meta":{"origin":3977,"position":5},"title":"Ubuntu: mongodb won&#8217;t start [FIXED]","author":"gubatron","date":"May 23, 2012","format":false,"excerpt":"So you decided to change the default location of your mongodb data path on mongodb.conf but mongo won't start and you get an error similar to this [bash] Wed May 23 04:17:35 [initandlisten] MongoDB starting : pid=1214 port=27017 dbpath=\/media\/ebs\/data 64-bit host=domU-12-31-38-00-78-DB Wed May 23 04:17:35 [initandlisten] db version v2.0.4, pdfile\u2026","rel":"","context":"In \"mongo\"","block_context":{"text":"mongo","link":"https:\/\/www.gubatron.com\/blog\/tag\/mongo\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/3977","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/comments?post=3977"}],"version-history":[{"count":5,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/3977\/revisions"}],"predecessor-version":[{"id":4116,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/posts\/3977\/revisions\/4116"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media\/4189"}],"wp:attachment":[{"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/media?parent=3977"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/categories?post=3977"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gubatron.com\/blog\/wp-json\/wp\/v2\/tags?post=3977"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}