{"id":10402,"date":"2022-02-02T07:59:00","date_gmt":"2022-02-02T05:59:00","guid":{"rendered":"https:\/\/raspberrytips.com\/?p=10402"},"modified":"2026-07-15T01:07:58","modified_gmt":"2026-07-14T23:07:58","slug":"resize-partition-ubuntu","status":"publish","type":"post","link":"https:\/\/raspberrytips.com\/resize-partition-ubuntu\/","title":{"rendered":"How To Safely Extend Your Ubuntu Partitions (GUI &#038; Commands)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Resizing partitions is not something to be taken lightly, as you can screw up your data with one wrong step or command parameter. When I was a Linux system administrator, I often had to extend partitions on critical servers, so I&#8217;ll share all of my tips with you in this tutorial. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The easiest and safest way to extend a Linux partition is to use the &#8220;GParted&#8221; application. It&#8217;s a graphical tool to resize partitions visually. When there is no GUI available, the commands fdisk and resize2fs can be used to extend your Ubuntu partitions instead.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Don&#8217;t worry, I&#8217;ll explain all of the steps in detail in this article, starting with the graphical method which seems easier and safer for most systems.<\/p>\n\n\n<style>.kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-table-of-content-wrap{padding-top:var(--global-kb-spacing-sm, 1.5rem);padding-right:var(--global-kb-spacing-sm, 1.5rem);padding-bottom:var(--global-kb-spacing-sm, 1.5rem);padding-left:var(--global-kb-spacing-sm, 1.5rem);background-color:var(--global-palette7, #EDF2F7);box-shadow:0px 0px 14px 0px rgba(0, 0, 0, 0.2);}.kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-table-of-contents-title-wrap{padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-table-of-contents-title{font-weight:regular;font-style:normal;}.kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-table-of-content-wrap .kb-table-of-content-list{font-size:var(--global-kb-font-size-sm, 0.9rem);font-weight:regular;font-style:normal;margin-top:var(--global-kb-spacing-sm, 1.5rem);margin-right:0px;margin-bottom:0px;margin-left:0px;}.kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-toggle-icon-style-basiccircle .kb-table-of-contents-icon-trigger:after, .kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-toggle-icon-style-basiccircle .kb-table-of-contents-icon-trigger:before, .kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-toggle-icon-style-arrowcircle .kb-table-of-contents-icon-trigger:after, .kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-toggle-icon-style-arrowcircle .kb-table-of-contents-icon-trigger:before, .kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-toggle-icon-style-xclosecircle .kb-table-of-contents-icon-trigger:after, .kb-table-of-content-nav.kb-table-of-content-id19563_c031ec-35 .kb-toggle-icon-style-xclosecircle .kb-table-of-contents-icon-trigger:before{background-color:var(--global-palette7, #EDF2F7);}<\/style>\n\n\n\n\n<h2 id=\"how-to-extend-a-partition-with-gparted-gui\" class=\"wp-block-heading\">How to Extend a Partition with GParted (GUI)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the main steps to extend a partition on Ubuntu:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Identify the partition name (ex: \/dev\/sda3)<\/strong>.<\/li>\n\n\n\n<li><strong>Create and boot on a Live system if you want to resize the system partition.<\/strong><\/li>\n\n\n\n<li><strong>Use GParted to resize the partition<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I will now give you all of the steps in detail.<\/p>\n\n\n\n<h3 id=\"identify-the-partition\" class=\"wp-block-heading\">Identify the Partition<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The first step is to identify the partition you want to expand. In most cases, this shouldn&#8217;t be complicated.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On a desktop computer, you probably have one big partition with your system and all of your files in it. You will need to be careful with more complicated installations, like if you have several hard drives, or if you divided your disk into several partitions (system, data, etc.).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>On your system, you can open the &#8220;Disk&#8221; tool to quickly see how your system is installed, and find the device name for your partition:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"694\" style=\"aspect-ratio: 992 \/ 694;\" width=\"992\" autoplay loop muted src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/02\/ubuntu-disk-tool.mp4\" playsinline><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In this typical case, there are three partitions on the disk, and almost everything is in the third one. The device name is <em>\/dev\/sda3<\/em>. Try the same steps on your system, and find the name of the partition you want to extend.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>In general, the system disk will be named <em>\/dev\/sda<\/em>, and the number after that corresponds to the partition identifier.<\/strong> If you have a second disk for your data, that might be <em>\/dev\/sdb1<\/em> for example.<\/p>\n\n\n\n<h3 id=\"optional-boot-on-a-live-usb-key\" class=\"wp-block-heading\">Optional: Boot on a Live-USB Key<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>It&#8217;s not possible to resize a partition that is currently mounted, so you need to unmount it first. But a system partition can&#8217;t be unmounted, that&#8217;s why a Live-USB key is often required.<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you boot on a Live-USB key, the system is no longer loaded from the hard drive, and we can unmount the partition safely. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This process is only required if you want to extend the system partition, in other cases, you can do it directly from your Ubuntu session:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Download Ubuntu from <a rel=\"noopener\" href=\"https:\/\/ubuntu.com\/download\/desktop\" target=\"_blank\" data-lasso-id=\"2976\">the official website<\/a>.<\/strong><\/li>\n\n\n\n<li><strong>Flash the image on a USB key.<br><\/strong>You can use a <a href=\"https:\/\/raspberrytips.com\/install-balena-etcher-ubuntu\/\">tool like Etcher<\/a>, Rufus, or the one you prefer and the system you use.<br><img loading=\"lazy\" decoding=\"async\" width=\"1000\" height=\"260\" class=\"wp-image-1195\" style=\"\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher.jpg\" alt=\"etcher menu\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher.jpg 1000w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher-300x78.jpg 300w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher-768x200.jpg 768w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher-1024x266.jpg 1024w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher-100x26.jpg 100w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher-864x225.jpg 864w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2019\/01\/etcher-800x208.jpg 800w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/li>\n\n\n\n<li><strong>Insert the USB key into your computer, and boot on it.<\/strong><br>On most computers, you&#8217;ll need to press F12 or DEL to get the boot menu and boot on it instead of the system on your hard drive.<\/li>\n\n\n\n<li><strong>Choose the live boot<\/strong> (we don&#8217;t want to reinstall Ubuntu).<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">From there, you can follow the same steps, as if your partition is no longer hosting your system.<\/p>\n\n\n\n<h3 id=\"recommended-backup-your-system\" class=\"wp-block-heading\">Recommended: Backup Your System<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When editing a partition table, you can easily break something which can result in your computer being unable to reboot properly. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>It&#8217;s highly recommended to create a backup of your data, especially for critical servers or files you don&#8217;t have anywhere else (don&#8217;t forget the configuration files).<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you don&#8217;t know how to do this, you can <a rel=\"noopener\" href=\"https:\/\/raspberrytips.com\/backup-raspberry-pi\/\" data-type=\"post\" data-id=\"716\" target=\"_blank\" data-lasso-id=\"2977\">follow this tutorial<\/a>. It&#8217;s for Raspberry Pi, but you can use the same steps and tips.<\/p>\n\n\n\n<h3 id=\"install-gparted\" class=\"wp-block-heading\">Install GParted<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">GParted is a tool I love to manage any partitioning task. In an intuitive interface, you can resize, create or delete partitions in a few clicks.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can <strong>find it in the Ubuntu Software catalog:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"219\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-catalog-1024x219.jpg\" alt=\"install gparted from ubuntu software catalog\" class=\"wp-image-10404\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-catalog-1024x219.jpg 1024w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-catalog-300x64.jpg 300w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-catalog-768x164.jpg 768w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-catalog.jpg 1119w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>Or you can install it with apt:<\/strong><br><code>sudo apt install gparted<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install it and start it to see your disk&#8217;s partitions (it should look like the Disk tool you used in a previous step). You&#8217;ll need to type your password to unlock the administrator mode.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"857\" height=\"326\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-partitions.jpg\" alt=\"gparted partition view\" class=\"wp-image-10405\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-partitions.jpg 857w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-partitions-300x114.jpg 300w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-partitions-768x292.jpg 768w\" sizes=\"auto, (max-width: 857px) 100vw, 857px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s a bit more detailed, as you can see all the partitions at a glance, the file system, the mount point and different sizes (total, used, unused). The yellow on the graphical visualization shows the used space.<\/p>\n\n\n\n<p class=\"has-theme-palette-7-background-color has-background wp-block-paragraph\"><strong>Note<\/strong>: If the partition you want to resize is NOT the system partition, you need to unmount it first. Right-click on it and choose &#8220;Unmount&#8221; to follow the next steps.<\/p>\n\n\n\r\n\t\t<!-- wp:paragraph -->\r\n\t<p  id=\"inpost_lm_linux_commands\"><b>Tip: <\/b> Command lines can be a pain to memorize. I put the essential Linux commands on a printable cheat sheet so you don't have to keep googling them.\u00a0You can <a rel=\"noreferrer noopener\" href=\"https:\/\/raspberrytips.com\/downloads\/?source=rb_linux&lm=4\" target=\"_blank\">grab the PDF here<\/a> if you want to save some time.<\/p>\r\n\t<!-- \/wp:paragraph -->\r\n\t\t\n\n\n<h3 id=\"extend-the-partition\" class=\"wp-block-heading\">Extend the Partition<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once on GParted, you can quickly resize any partition by following these steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Make sure to select the correct drive in the top-right corner.<br><\/strong>If you rebooted on a Live-USB key, the key is now probably <em>\/dev\/sda<\/em> and your system is on <em>\/dev\/sdb<\/em>. The partition number doesn&#8217;t change, just the drive name.<\/li>\n\n\n\n<li>For example, let&#8217;s say you have something like:<br><img loading=\"lazy\" decoding=\"async\" width=\"835\" height=\"278\" class=\"wp-image-10406\" style=\"\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/example-partitions.jpg\" alt=\"gparted extend partition example\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/example-partitions.jpg 835w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/example-partitions-300x100.jpg 300w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/example-partitions-768x256.jpg 768w\" sizes=\"auto, (max-width: 835px) 100vw, 835px\" \/><br>On <em>\/dev\/sdb<\/em>, I have one partition that is about 8GB, but my disk is 16GB total. I want to extend <em>\/dev\/sdb1<\/em> to use the full size.<\/li>\n\n\n\n<li><strong>Right-click on the partition you want to extend and choose &#8220;Resize\/Move&#8221;.<br><\/strong>This window shows up:<br><img loading=\"lazy\" decoding=\"async\" width=\"573\" height=\"348\" class=\"wp-image-10407\" style=\"\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-resize.jpg\" alt=\"gparted resize\/move window\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-resize.jpg 573w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-resize-300x182.jpg 300w\" sizes=\"auto, (max-width: 573px) 100vw, 573px\" \/><\/li>\n\n\n\n<li>From there, the easiest way would be to grab the right arrow on the graphical visualization and move it to the right. But you can also use the form below and update the new size field to the maximum value.<\/li>\n\n\n\n<li><strong>Once done, click on &#8220;Resize\/Move&#8221;.<\/strong> GParted will show you the result directly.<\/li>\n\n\n\n<li>If it&#8217;s fine for you, click on the green tick to apply the changes.<br><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"318\" class=\"wp-image-10408\" style=\"\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-resized.jpg\" alt=\"gparted apply changes\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-resized.jpg 800w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-resized-300x119.jpg 300w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/gparted-resized-768x305.jpg 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it! After a few seconds (or minutes, depending on the size of your disk), your partition table has been updated, and you can now use your whole disk. If you are on a Live-USB system, you can now reboot your normal session and enjoy your new disk space.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a video summarizing all the previous steps to make it even more clear:<\/p>\n\n\n\n<figure class=\"wp-block-video aligncenter\"><video height=\"400\" style=\"aspect-ratio: 800 \/ 400;\" width=\"800\" autoplay loop muted src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/02\/gparted-resize-ubuntu.mp4\" playsinline><\/video><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If the resized partition wasn&#8217;t your system partition, don&#8217;t forget to mount it back (or to restart your system).<\/p>\n\n\n\n<h2 id=\"how-to-extend-a-partition-from-the-command-line\" class=\"wp-block-heading\">How to Extend a Partition from the Command Line<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Overall, the steps to extend a partition from a command line are the same as with a GUI:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Identify the partition name and the disk space available with <em>fdisk<\/em><\/strong>.<\/li>\n\n\n\n<li><strong>Unmount the partition with <em>umount<\/em><\/strong>.<\/li>\n\n\n\n<li><strong>Use <em>resize2fs <\/em>to extend the partition size<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">When possible, I highly recommend using a Live-USB key <a href=\"https:\/\/raspberrytips.com\/best-desktop-environments-ubuntu\/\">with a GUI<\/a> to do these steps. A mistake can easily happen, especially when you use the command line. Using the previous method will be easier and less risky.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Only follow these steps when you can&#8217;t reboot the computer (so when you are not resizing the system partition).<\/p>\n\n\n\n<h3 id=\"identify-the-partition-to-resize\" class=\"wp-block-heading\">Identify the Partition to Resize<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>On a server without GUI, we can&#8217;t use GParted or the disk tool to find the partition name. In this case, the &#8220;fdisk&#8221; command will do the same thing for you:<\/strong><br><code>sudo fdisk -l<\/code><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"490\" height=\"173\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/fdisk-sda.jpg\" alt=\"fdisk \" class=\"wp-image-10412\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/fdisk-sda.jpg 490w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/fdisk-sda-300x106.jpg 300w\" sizes=\"auto, (max-width: 490px) 100vw, 490px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">The output will include several paragraphs like the one in the pictures, each one corresponding to a physical disk. For example, in this screenshot, you can see the <em>\/dev\/sda<\/em> drive, which is 16 GiB and contains a partition that takes only 2 Gib.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I will show you how to extend this partition.<\/p>\n\n\n<style>.kt-post-loop11284_10feef-87 .kadence-post-image{padding-top:0px;padding-right:30px;padding-bottom:10px;padding-left:0px;}.kt-post-loop11284_10feef-87 .kt-feat-image-align-left{grid-template-columns:40% auto;}.kt-post-loop11284_10feef-87 .kt-post-grid-layout-masonry-wrap .kt-post-masonry-item{padding-left:15px;padding-right:15px;}.kt-post-loop11284_10feef-87 .kt-post-grid-layout-masonry-wrap{margin-left:-15px;margin-right:-15px;}.kt-post-loop11284_10feef-87 .kt-post-grid-layout-masonry-wrap .kt-post-masonry-item{padding-bottom:30px;}.kt-post-loop11284_10feef-87 .kt-blocks-post-grid-item{border-top-left-radius:0px;border-top-right-radius:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-top-color:currentColor;border-top-style:solid;border-right-color:currentColor;border-right-style:solid;border-bottom-color:currentColor;border-bottom-style:solid;border-left-color:currentColor;border-left-style:solid;background-color:var(--global-palette7, #EDF2F7);overflow:hidden;}.kt-post-loop11284_10feef-87 .kt-blocks-post-grid-item .kt-blocks-post-grid-item-inner{padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;}.kt-post-loop11284_10feef-87 .kt-blocks-post-grid-item header{padding-top:0px;padding-right:0px;padding-bottom:10px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;}.kt-post-loop11284_10feef-87 .kt-blocks-post-grid-item .kt-blocks-above-categories{font-size:13px;line-height:20px;text-transform:uppercase;}.kt-post-loop11284_10feef-87 .kt-blocks-post-grid-item .entry-title{padding-top:5px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:24px;line-height:30px;}.kt-post-loop11284_10feef-87 .entry-content{padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:14px;line-height:24px;}.kt-post-loop11284_10feef-87 .kt-blocks-post-footer{border-top-width:0px;border-right-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0px;font-size:12px;line-height:20px;text-transform:uppercase;}.kt-post-loop11284_10feef-87 .entry-content:after{height:0px;}.kt-post-loop11284_10feef-87 .kb-filter-item{border-top-width:0px;border-right-width:0px;border-bottom-width:2px;border-left-width:0px;padding-top:5px;padding-right:8px;padding-bottom:5px;padding-left:8px;margin-top:0px;margin-right:10px;margin-bottom:0px;margin-left:0px;}@media all and (max-width: 1024px){.kt-post-loop11284_10feef-87 .kt-blocks-post-grid-item{border-top-color:currentColor;border-top-style:solid;border-right-color:currentColor;border-right-style:solid;border-bottom-color:currentColor;border-bottom-style:solid;border-left-color:currentColor;border-left-style:solid;}}@media all and (max-width: 767px){.kt-post-loop11284_10feef-87 .kt-blocks-post-grid-item{border-top-color:currentColor;border-top-style:solid;border-right-color:currentColor;border-right-style:solid;border-bottom-color:currentColor;border-bottom-style:solid;border-left-color:currentColor;border-left-style:solid;}}<\/style><div class=\"wp-block-kadence-postgrid kt-blocks-post-loop-block alignnone kt-post-loop11284_10feef-87 kt-post-grid-layout-masonry \"><div class=\"kt-post-grid-layout-masonry-wrap kt-post-grid-wrap kb-pro-masonry-init\" data-columns-xxl=\"1\" data-columns-xl=\"1\" data-columns-md=\"1\" data-columns-sm=\"1\" data-columns-xs=\"1\" data-columns-ss=\"1\"data-item-selector=\".kt-post-masonry-item\" aria-label=\"Post Carousel\"><div class=\"kt-post-masonry-item post-21736 post type-post status-publish format-standard has-post-thumbnail hentry category-linux\"><article class=\"kt-blocks-post-grid-item\"><div class=\"kt-blocks-post-grid-item-inner-wrap kt-feat-image-align-left kt-feat-image-mobile-align-top\"><div class=\"kadence-post-image\"><div class=\"kadence-post-image-intrisic kt-image-ratio-56-25\" style=\"padding-bottom:56.25%;\"><div class=\"kadence-post-image-inner-intrisic\"><a aria-hidden=\"true\" tabindex=\"-1\" role=\"presentation\" href=\"https:\/\/raspberrytips.com\/fdisk-linux-command\/\" aria-label=\"How To Use &#8216;fdisk&#8217;: The Complete Linux Command Guide\" class=\"kadence-post-image-inner-wrap\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2023\/12\/linux-command-featured-1024x683.jpg\" class=\"attachment-large size-large wp-post-image\" alt=\"fdisk linux command\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2023\/12\/linux-command-featured-1024x683.jpg 1024w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2023\/12\/linux-command-featured-300x200.jpg 300w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2023\/12\/linux-command-featured-768x512.jpg 768w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2023\/12\/linux-command-featured.jpg 1200w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/div><\/div><\/div><div class=\"kt-blocks-post-grid-item-inner\"><header><h4 class=\"entry-title\"><a href=\"https:\/\/raspberrytips.com\/fdisk-linux-command\/\">How To Use &#8216;fdisk&#8217;: The Complete Linux Command Guide<\/a><\/h4><div class=\"kt-blocks-post-top-meta\"><\/div><\/header><div class=\"entry-content\">Fdisk is a command line used on Linux to handle everything related to the partition table on a storage drive. But using it can be challenging, and with this kind&#8230;<\/div><footer class=\"kt-blocks-post-footer\"><div class=\"kt-blocks-post-footer-left\"><\/div><div class=\"kt-blocks-post-footer-right\"><\/div><\/footer><\/div><\/div><\/article><\/div><\/div><\/div><!-- .wp-block-kadence-postgrid -->\n\n\n<h3 id=\"recommended-backup-your-system\" class=\"wp-block-heading\">Recommended: Backup Your System<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">When editing a partition table, you can easily break something and have your computer unable to reboot properly. It&#8217;s highly recommended to create a backup of your data, especially for critical servers or files you don&#8217;t have anywhere else (don&#8217;t forget the configuration files).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you don&#8217;t know how to do this, you can <a rel=\"noopener\" href=\"https:\/\/raspberrytips.com\/backup-raspberry-pi\/\" data-type=\"post\" data-id=\"716\" target=\"_blank\" data-lasso-id=\"2978\">follow this tutorial<\/a>. It&#8217;s for Raspberry Pi, but you can use the same steps and tips.<\/p>\n\n\n\n<h3 id=\"extend-a-partition-from-the-command-line\" class=\"wp-block-heading\">Extend a Partition from the Command Line<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here are the steps to follow to resize a partition from the command line:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Make sure the partition is not mounted, use:<br><\/strong><code>sudo umount \/dev\/sda1<\/code><br>Adjust the parameter to fit your partition name (<em>\/dev\/sdb3<\/em> for example).<\/li>\n\n\n\n<li><strong>Open fdisk to edit the partition table:<br><\/strong><code>sudo fdisk \/dev\/sda<\/code><\/li>\n\n\n\n<li><strong>Delete the existing partition:<br><\/strong><code>d<br><\/code>Type the corresponding number (in my case I have only one partition, but if it&#8217;s <em>\/dev\/sdb3<\/em> for example, you need to type &#8220;3&#8221;).<br>This step can be scary, but don&#8217;t worry, you shouldn&#8217;t lose your data as we don&#8217;t format the disk content (make sure to have a backup anyway!).<\/li>\n\n\n\n<li><strong>Create the new partition:<br><\/strong><code>n<\/code><br>Answer the questions to create a new partition, you should probably keep the default values. Just set the new partition size by using something like &#8220;+8GB&#8221; for the last sector.<\/li>\n\n\n\n<li><strong>Check that the new partition table is what you wanted:<\/strong><br><code>p<\/code><\/li>\n\n\n\n<li><strong>And if so, write the change to your disk:<\/strong><br><code>w<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Here is my full log if you are unsure at some point:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"718\" height=\"685\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/fdisk-create-new-bigger.jpg\" alt=\"fdisk extend partition bigger\" class=\"wp-image-10413\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/fdisk-create-new-bigger.jpg 718w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/fdisk-create-new-bigger-300x286.jpg 300w\" sizes=\"auto, (max-width: 718px) 100vw, 718px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\"><strong>The last step is to actually resize the file system to fit the new partition size, you can do this easily with:<\/strong><br><code>sudo resize2fs \/dev\/sda1<\/code><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"79\" src=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/resize2fs.jpg\" alt=\"resize2fs command\" class=\"wp-image-10416\" srcset=\"https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/resize2fs.jpg 512w, https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/resize2fs-300x46.jpg 300w\" sizes=\"auto, (max-width: 512px) 100vw, 512px\" \/><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">You can now <a href=\"https:\/\/raspberrytips.com\/mount-linux-command\/\" data-type=\"post\" data-id=\"22167\">mount your partition<\/a> and enjoy more free space!<br><code>sudo mount \/dev\/sda1<br><\/code>Or something like:<br><code>sudo mount \/dev\/sda1 \/mnt\/data<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Related article<\/strong>: <a href=\"https:\/\/raspberrytips.com\/linux-commands-usb-drives\/\" data-type=\"post\" data-id=\"2423\">How to format and mount a USB drive on Linux?<\/a><\/p>\n\n\n\n<h2 id=\"extend-a-partition-related-questions\" class=\"wp-block-heading\">Related Questions: Extending a Partition <\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What if there&#8217;s another partition at the end of the one I want to extend?<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In some cases, you have the main partition (let&#8217;s say <em>\/dev\/sda1<\/em>) and then your data partition (<em>\/dev\/sda2<\/em>) and finally some unallocated disk space at the end. To extend <em>\/dev\/sd1<\/em>, you&#8217;ll need to first move <em>\/dev\/sda2<\/em> to the end of the disk. You can do this with GParted and then follow the same steps to resize <em>\/dev\/sda1<\/em>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now that you have more space available on your system, you are ready to try new exciting projects with Linux, here are a few suggestions I have covered on this website:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/raspberrytips.com\/install-retropie-on-ubuntu\/\" data-type=\"post\" data-id=\"12936\">How To Install RetroPie On Ubuntu: A Step-by-step Guide<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/raspberrytips.com\/install-home-assistant-on-ubuntu\/\" data-type=\"post\" data-id=\"12273\">Install Home Assistant on Ubuntu: A Step-by-step guide<\/a><\/li>\n<\/ul>\n\n\n<section id=\"end-block-pi\">\r\n<div class=\"rt-community-card \">\r\n\t<div class=\"rt-community-card__inner\">\r\n\r\n\t\t<div class=\"rt-community-card__main\">\r\n\t\t\t<h3 class=\"rt-community-card__headline\">\r\n\t\t\t\tNot getting the same result?\t\t\t<\/h3>\r\n\r\n\t\t\t<p class=\"rt-community-card__description\">\r\n\t\t\t\tEven when you follow every step, small differences in OS version, hardware or config can change the outcome. Instead of wasting time guessing, get help from people who have already fixed the same kind of issue.\t\t\t<\/p>\r\n\r\n\t\t\t<div class=\"rt-community-card__actions\">\r\n\t\t\t\t<a class=\"rt-community-card__button\" href=\"https:\/\/raspberrytips.com\/school\/community\/?coupon=EBCTY\">\r\n\t\t\t\t\t<span>Ask your question now<\/span>\r\n\t\t\t\t\t<span class=\"rt-community-card__button-arrow\">\u2192<\/span>\r\n\t\t\t\t<\/a>\r\n\r\n\t\t\t\t\t\t\t\t\t<div class=\"rt-community-card__small\">\r\n\t\t\t\t\t\t<span class=\"rt-community-card__small-lock\">\ud83d\udd12<\/span>\r\n\t\t\t\t\t\tNo risk. Cancel anytime.\t\t\t\t\t<\/div>\r\n\t\t\t\t\t\t\t<\/div>\r\n\t\t<\/div>\r\n\r\n\t\t\t\t\t<div class=\"rt-community-card__side\">\r\n\t\t\t\t<ul class=\"rt-community-card__benefits\">\r\n\t\t\t\t\t\t\t\t\t\t\t<li>Get help on your exact issue<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t<li>Access step-by-step videos for tricky setups<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t<li>Browse the website without ads<\/li>\r\n\t\t\t\t\t\t\t\t\t<\/ul>\r\n\t\t\t<\/div>\r\n\t\t\r\n\t<\/div>\r\n<\/div>\r\n<\/section>\r\n\r\n<style>\r\n.rt-community-card {\r\n\t--rt-bg: #f7f7f9;\r\n\t--rt-border: #e4e4e8;\r\n\t--rt-text: #15171b;\r\n\t--rt-muted: #5b6270;\r\n\t--rt-accent: #C61E4A;\r\n\t--rt-accent-hover: #aa183f;\r\n\t--rt-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);\r\n\r\n\tmargin: 36px 0;\r\n\tcolor: var(--rt-text);\r\n\tfont-family: inherit;\r\n}\r\n\r\n.rt-community-card__inner {\r\n\tdisplay: grid;\r\n\tgrid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.95fr);\r\n\tgap: 34px;\r\n\talign-items: start;\r\n\tbackground: var(--rt-bg);\r\n\tborder: 1px solid var(--rt-border);\r\n\tborder-radius: 22px;\r\n\tpadding: 34px 36px;\r\n\tbox-shadow: var(--rt-shadow);\r\n}\r\n\r\n.rt-community-card__main {\r\n\tmin-width: 0;\r\n}\r\n\r\n.rt-community-card__side {\r\n\tborder-left: 1px solid #e1e1e6;\r\n\tpadding-left: 28px;\r\n}\r\n\r\n.rt-community-card__benefits {\r\n\tmargin: 6px 0 0;\r\n\tpadding: 0;\r\n\tlist-style: none;\r\n\tdisplay: grid;\r\n\tgap: 18px;\r\n}\r\n\r\n.rt-community-card__benefits li {\r\n\tposition: relative;\r\n\tpadding-left: 18px;\r\n\tfont-size: 18px;\r\n\tline-height: 1.55;\r\n\tcolor: var(--rt-text);\r\n}\r\n\r\n.rt-community-card__benefits li::before {\r\n\tcontent: \"\";\r\n\tposition: absolute;\r\n\tleft: 0;\r\n\ttop: 0.72em;\r\n\twidth: 7px;\r\n\theight: 7px;\r\n\tborder-radius: 999px;\r\n\tbackground: var(--rt-accent);\r\n\ttransform: translateY(-50%);\r\n}\r\n\r\n.rt-community-card__actions {\r\n\tdisplay: flex;\r\n\tflex-direction: column;\r\n\talign-items: flex-start;\r\n\tgap: 10px;\r\n\tmargin-top: 30px;\r\n}\r\n\r\n.rt-community-card__button {\r\n\tdisplay: inline-flex;\r\n\talign-items: center;\r\n\tjustify-content: center;\r\n\tgap: 10px;\r\n\tmin-height: 60px;\r\n\tpadding: 0 28px;\r\n\tborder-radius: 14px;\r\n\tbackground: var(--rt-accent);\r\n\tcolor: #fff !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 21px;\r\n\tfont-weight: 700;\r\n\tline-height: 1;\r\n\tbox-shadow: 0 12px 22px rgba(198, 30, 74, 0.22);\r\n\ttransition: background .2s ease, transform .2s ease, box-shadow .2s ease;\r\n}\r\n\r\n.rt-community-card__button:hover {\r\n\tbackground: var(--rt-accent-hover);\r\n\tcolor: #fff !important;\r\n\ttransform: translateY(-1px);\r\n\tbox-shadow: 0 14px 26px rgba(198, 30, 74, 0.28);\r\n}\r\n\r\n.rt-community-card__button-arrow {\r\n\tfont-size: 20px;\r\n\tline-height: 1;\r\n}\r\n\r\n.rt-community-card__small {\r\n\tfont-size: 15px;\r\n\tline-height: 1.5;\r\n\tcolor: #6a717d;\r\n\tpadding-left: 2px;\r\n}\r\n\r\n.rt-community-card__small-lock {\r\n\tmargin-right: 6px;\r\n\tfont-size: 14px;\r\n\tvertical-align: baseline;\r\n}\r\n\r\n\/* Tablet *\/\r\n@media (max-width: 900px) {\r\n\t.rt-community-card {\r\n\t\tmargin: 28px 0;\r\n\t}\r\n\r\n\t.rt-community-card__inner {\r\n\t\tgrid-template-columns: 1fr;\r\n\t\tgap: 24px;\r\n\t\tpadding: 28px 24px;\r\n\t}\r\n\r\n\t.rt-community-card__side {\r\n\t\tborder-left: 0;\r\n\t\tborder-top: 1px solid #e1e1e6;\r\n\t\tpadding-left: 0;\r\n\t\tpadding-top: 22px;\r\n\t}\r\n\r\n\t.rt-community-card__benefits {\r\n\t\tgrid-template-columns: 1fr;\r\n\t\tgap: 12px;\r\n\t}\r\n}\r\n\r\n\/* Mobile *\/\r\n@media (max-width: 640px) {\r\n\t.rt-community-card__inner {\r\n\t\tpadding: 22px 18px;\r\n\t\tborder-radius: 18px;\r\n\t\tgap: 20px;\r\n\t}\r\n\t\r\n\t.rt-community-card__side {\r\n\t\tpadding-top: 18px;\r\n\t}\r\n\r\n\t.rt-community-card__benefits li {\r\n\t\tfont-size: 16px;\r\n\t}\r\n\r\n\t.rt-community-card__actions {\r\n\t\tmargin-top: 24px;\r\n\t\talign-items: stretch;\r\n\t}\r\n\r\n\t.rt-community-card__button {\r\n\t\twidth: 100%;\r\n\t\tmin-height: 56px;\r\n\t\tfont-size: 18px;\r\n\t\tpadding: 0 20px;\r\n\t}\r\n\r\n\t.rt-community-card__small {\r\n\t\ttext-align: center;\r\n\t\tpadding-left: 0;\r\n\t}\r\n}\r\n<\/style>\r\n\t\r\n","protected":false},"excerpt":{"rendered":"<p>Resizing partitions is not something to be taken lightly, as you can screw up your data with one wrong step or command parameter. When I was a Linux system administrator, I often had to extend partitions on critical servers, so I&#8217;ll share all of my tips with you in this tutorial. The easiest and safest&#8230;<\/p>\n","protected":false},"author":1,"featured_media":10417,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","footnotes":""},"categories":[27],"tags":[],"class_list":["post-10402","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux"],"taxonomy_info":{"category":[{"value":27,"label":"Linux tutorials"}]},"featured_image_src_large":["https:\/\/raspberrytips.com\/wp-content\/uploads\/2022\/01\/extend-partition-ubuntu-1024x683.jpg",1024,683,true],"author_info":{"display_name":"Patrick Fromaget","author_link":"https:\/\/raspberrytips.com\/author\/admin\/"},"comment_info":0,"category_info":[{"term_id":27,"name":"Linux tutorials","slug":"linux","term_group":0,"term_taxonomy_id":27,"taxonomy":"category","description":"","parent":0,"count":108,"filter":"raw","cat_ID":27,"category_count":108,"category_description":"","cat_name":"Linux tutorials","category_nicename":"linux","category_parent":0}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/posts\/10402","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/comments?post=10402"}],"version-history":[{"count":23,"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/posts\/10402\/revisions"}],"predecessor-version":[{"id":53853,"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/posts\/10402\/revisions\/53853"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/media\/10417"}],"wp:attachment":[{"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/media?parent=10402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/categories?post=10402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberrytips.com\/wp-json\/wp\/v2\/tags?post=10402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}