Categories
Interior

How to resize your ubuntu partitions

Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader’s Digest, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek. Read more.

How to resize your ubuntu partitions

Whether you want to shrink your Ubuntu partition, enlarge it, or split it up into several partitions, you can’t do this while it’s in use. You’ll need a Ubuntu live CD or USB drive to edit your partitions.

The Ubuntu live CD includes the GParted partition editor, which can modify your partitions. GParted is a full-featured, graphical partition editor that acts as a frontend to a variety of Linux terminal commands.

Boot From CD or USB Drive

If you have the CD or USB drive you installed Ubuntu from, you can insert it into your computer and restart. If you don’t, you’ll have to create a new Ubuntu live media. You can download an Ubuntu ISO from Ubuntu.com and burn it a disc by right-clicking the downloaded ISO file and selecting Write to Disc.

How to resize your ubuntu partitions

If you’d rather use a USB drive, use the Startup Disk Creator application, which comes with Ubuntu. You’ll find it in the Dash.

How to resize your ubuntu partitions

Provide the Startup Disk Creator application with a Ubuntu ISO and a USB flash drive and it will create a live USB drive for you.

How to resize your ubuntu partitions

After creating the live media, insert it into your computer and restart. If the live environment doesn’t start, you may have to enter your computer’s BIOS and change its boot order. To access the BIOS, press the key that appears on you screen while your computer boots, often Delete, F1, or F2. You can find the appropriate key in your computer’s (or motherboard’s, if you assembled your own computer) manual.

Using GParted

While the GParted partition editor isn’t present by default on an installed Ubuntu system, it is included with the Ubuntu live environment. Launch GParted from the Dash to get started.

How to resize your ubuntu partitions

If you have multiple hard drives in your computer, select the appropriate one from the drop-down box at the top right corner of the GParted window.

How to resize your ubuntu partitions

Partitions can’t be modified while they’re in use — partitions in use have a key icon next to them. If a partition is mounted, unmount it by clicking the eject button in the file manager. If you have a swap partition, the Ubuntu live environment will likely have activated it. To deactivate the swap partition, right-click it and select Swapoff.

How to resize your ubuntu partitions

To resize a partition, right-click it and select Resize/Move.

How to resize your ubuntu partitions

The easiest way to resize a partition is by clicking and dragging the handles at either side of the bar, although you can also enter exact numbers. You can shrink any partition if it has free space.

How to resize your ubuntu partitions

Your changes won’t take effect immediately. Each change you make it queued, and appears in a list at the bottom of the GParted window.

How to resize your ubuntu partitions

Once you’ve shrunk a partition, you could use the unallocated space to create a new partition, if you like. To do so, right-click the unallocated space and select New. GParted will walk you through creating the partition.

How to resize your ubuntu partitions

If a partition has adjacent unallocated space, you can right-click it and select Resize/Move to enlarge the partition into the unallocated space.

How to resize your ubuntu partitions

To specify a new partition size, click and drag the sliders or enter an exact number into the boxes.

How to resize your ubuntu partitions

GParted shows a warning whenever you move the start sector of a partition. If you move the start sector of your Windows system partition (C:) or the Ubuntu partition containing your /boot directory — likely your primary Ubuntu partition — your operating system may fail to boot. In this case, we’re only moving the start sector of our swap partition, so we can ignore this warning. If you’re moving the start sector of your main Ubuntu partition, you’ll likely have to reinstall Grub 2 afterwards.

If your system does fail to boot, you can consult the Ubuntu wiki for several methods of reinstalling GRUB 2. The process is different from restoring the older GRUB 1 boot loader.

How to resize your ubuntu partitions

Click the green check mark icon on GParted’s toolbar to apply the changes when you’re finished.

How to resize your ubuntu partitions

Back ups are always important. However, back ups are particularly important if you’re modifying your partitions — a problem could occur and you may lose your data. Don’t resize your partitions until you’ve backed up any important data.

How to resize your ubuntu partitions

After you click Apply, GParted will apply all queued changes. This may take a while, depending on the changes you make. Don’t cancel the operation or power down your computer while the operation is in progress.

How to resize your ubuntu partitions

Restart your system and remove the CD or USB drive after performing the operations.

Sometimes you may need to enlarge, shrink, or split your Ubuntu partitions. In other words, you may need to resize partition in your Linux system. In this article, we will look at how to resize partitions in Ubuntu. You can use these steps in other Linux distributions also.

How to Resize Partition in Ubuntu

Here are the steps to resize Partition in Ubuntu. We will use GParted partition editor, which ships with Ubuntu CD. It is a feature-rich graphical partition editor that can be used for all your partition related tasks.

1. Boot from Ubuntu or GParted CD

Restart your system using Ubuntu installation on a CD/USB or using Gparted disk. If you don’t have a bootable cd, download Ubuntu ISO from here and burn it to a disc.

How to resize your ubuntu partitions

2. Open GParted

Open GParted from Ubuntu Live environment. You can launch it from Dash

How to resize your ubuntu partitions

3. Resize Partition

You will see a window with all the partitions on your system.

How to resize your ubuntu partitions

Please note, you cannot resize a partition that is in use. So if your partition is in use, then open file manager, right click on this partition, and select Unmount option from dropdown menu to unmount it. If it is a swap partition, then select Swap off option instead.

How to resize your ubuntu partitions

Right-click the one you want to resize and click ‘Resize/Move’ from dropdown menu.

How to resize your ubuntu partitions

You will see the following window, that allows you to resize partition either by dragging the bar handles, or entering exact partition size numbers. Click Resize/Move to save changes.

How to resize your ubuntu partitions

Please note, your changes will be enqueued in GParted and not applied immediately.

How to resize your ubuntu partitions

4. Create New Partition

If you have shrunk your partition and ended up with free space on your disk due to resizing, you can create a new partition out of it. Just right click the unallocated space and click New from dropdown menu. Gparted will start the wizard for new partition creation.

How to resize your ubuntu partitions

Instead, you may also expand other partitions to use this unallocated space.

5. Apply changes

Click the green tick mark to apply changes in Gparted. This will take a while. Don’t switch off your system or cancel the changes midway when the operations are being applied. In case of any errors/conflicts, it will show you an error message.

How to resize your ubuntu partitions

6. Restart System

Restart the system, without bootable cd or USB to work with your new partitions.

In this article, we have looked at how to resize Ubuntu partitions. Please make sure you have taken a backup of all the disks you want to resize, before you perform the above operations.

How to resize your ubuntu partitions

I used to be able to do these tasks with my eyes closed with AIX and other version of Linux and Unix. Today my brain blue screened on me while trying to expand my Ubuntu machine’s root volume group, logical volume, and filesystem. Wow it’s been awhile.

So instead of racking my brain in the future I will jot down the process here for anyone else stuck in the same situation.

How to expand Ubuntu root filesystem

So a quick recap for those that don’t remember. We have to expand components of the filesystem in the following order. Physical Volume -> Volume Group -> Logical Volume -> Filesystem

In my scenario I increased the size of my Virtual Machine disk in VMware from 18GB to 28 GB.

  • Step 1 Before we get started run pvdisplay in order to see the current state of the physical volume
  • Step 2 Manipulate the disk partition table with fdisk

Accept the default values that are provide that the “n” option returns.

Step 3 Reboot your Ubuntu machine in order for Ubuntu to recognize the change.
[email protected]:

Step 4 Update the partition table tool using cfdisk.
[email protected]:

# cfdisk
Select [NEW] partition and [PRIMARY] for partition type. Select how big you want the partition and enter.
Once finished select [WRITE] to save your changes to your partition then [QUIT].
You’ve now created a new partition most likely /dev/sda1
How to resize your ubuntu partitions

Step 5 Intialize the newly created partition with pvcreate

  • Step 6 Add the newly created partition to the root volume group. First rerun pvdisplay to show the new physical volume details. You should now see the new partition

Run the command vgs in order to get the name of your volume group

Expand the volume group with vgextend then verify your volume group again once complete with vgs

  • Step 7 Next we need to extend the Logical Volume with lvextend
  • Step 8 Extend the Filesystem to fill the logical volume

Ubuntu Root Resize in Review

Hopefully this tutorial will save you time and give you a little more background on the flow of a resize. Important to remember is the path of the resize Physical Volume -> Volume Group -> Logical Volume -> Filesystem. We must follow this flow or the resize will either fail or encounter problems. If you use the Ubuntu GUI some tools contain the entire process in a single tool.

I’m a CLI junkie so no plans of me finding out how a GUI works anytime soon.

Follow me

If you liked this article be sure to Follow Me on Twitter to stay updated!

The following is a screenshot of my current partitions, shown by gparted:

How to resize your ubuntu partitions

Note that the partitions on the right of /dev/sda3 , without labels on them in the figure,

are /dev/sda6 (for /home ), /dev/sda7 (for / ), unallocated, and /dev/sda5 (for swap), from left to right,

taken together, constitute the contents of the extended partition /dev/sda4 .

I would like to resize the partitions, such that some unused space from /dev/sda7 (for / ) and the small unallocated space can be moved to /dev/sda3 (for /windows-d ) and make it larger.

If this is possible, how can I do it?

How to resize your ubuntu partitions

2 Answers 2

This is similar to this question, except that there, space outside of an extended partition was moved into an extended partition, and then used by a logical partition (in the extended). In this question, space inside an extended partition needs to be moved out of the extended partition, and used by a primary partition. While the situations are different, I’ve based this answer on my answer to that question.

First, make sure that:

All your documents and other important (i.e., hard to replace) files from all your partitions are backed up. Moving and resizing partitions dynamically carries with it a small risk of data loss (for example, if there is a power failure, if one of your filesystems is broken in a way GParted does not know how to detect, or if there is a bug in GParted), plus you could make a mistake and accidentally wipe something out.

You are running from a live CD/DVD or USB flash drive, rather than running GParted out of the installed Ubuntu system. It is unsafe (and would almost certainly not succeed) to dynamically move and resize partitions on the same physical disk as the OS you use to do it.

Provided that this is taken care of, you have to perform 4 (or 5) operations. It will definitely take a while for GParted to perform them.

Shrink /dev/sda7 ( / ) down to whatever size you like. Remember to leave some space, because you need to have some free space on / for Ubuntu to update and install software, store non-user-specific files (including global configuration files), keep system logs, and so that applications can store data in /var and /tmp .

  • I recommend shrinking this on the left (i.e., increasing Free space preceding). However, if you are insistent on attempting to reclaim the 3 MiB of space between the end of /dev/sda7 ( / ) and /dev/sda5 (your swap partition), then you might as well instead shrink it on the right (increasing Free space following), then move the partition to the right. Please note that performing these two separate operations will make things take longer, and is almost certainly not worth it if your goal is to maximize available space. On the other hand, if the issue is that you’re personally bugged by an ugly partition table, go ahead. 😉

This step creates unallocated space in the extended partition, between /dev/sda6 ( /home ) and /dev/sda7 ( / ).

Move /dev/sda6 ( /home ) as far to the right as it will go, inside the extended partition. This moves the unallocated space to the very beginning (i.e., left side) of the extended partition.

Shrink /dev/sda4 (the extended partition) on the left (increasing the Free space preceding). When I tried this to make sure it would work properly, I found that it did, but that I had to manually specify a different Free space preceding number. Once I supplied any number manually, I was then able to shrink my extended partition easily by dragging its left edge to the right (as you’d expect to be able to do from the get-go). I’m not sure if you will experience this issue, but if you do, you can use that workaround.

This step moves the unallocated space out of the the extended partition.

Expand /dev/sda3 ( /windows-d ) on the right as much as possible (decreasing Free space following), so that its right edge is flush with (or as close as possible to) the left edge of /dev/sda4 (the extended partition you’ve just shrunk down).

This step moves eliminates the unallocated space, converting it into free space inside your /dev/sda3 Windows partition.

You must apply your changes to get GParted to perform the operations. To do this, click the green check-mark. After the operations complete, make sure your partition layout looks the way you want it, and quit GParted.

Since you have no separate /boot partition, the boot files for your Ubuntu system are located in the / partition ( /dev/sda7 ). Since you have changed where this partition starts (i.e., the location of its left edge), and where the extended partition that contains it starts, it’s likely that your Ubuntu system will not be able to boot. Fortunately, fixing this is easy, and consists of reinstalling GRUB2 (your boot loader) to your Master Boot Record.

If you want to try shutting down / restarting the live CD/DVD/USB system and booting into your Ubuntu system at this point, you can, but it’s likely enough that you’ll have to reinstall GRUB2 to the MBR that I recommend just doing it before rebooting. You can use any of the methods presented here.

Since you’ll probably have to do this, I’ll detail one method in this answer (with specifics of your system filled in). In the live CD/DVD/USB system, open a Terminal window ( Ctrl + Alt + T ) and run these commands:

Then reboot into the Ubuntu system installed on the hard disk, to make sure everything is working. It’s also a good idea to boot into the Windows, and make sure it recognizes the NTFS partition. If Windows wants to perform a chkdsk scan and fix problems, you should let it.

Some users don’t know how to resize Ubuntu partition when they find the partition size is unreasonably. This article will show you how to resize Ubuntu partition under Windows.

What Is Ubuntu

Ubuntu is a kind of Linux operating system, and it is developed by Mark Shuttleworth on the basis of Debian. This operating system is developed to make it easy to use personal computer.Meanwhile, it also offers server edition for enterprise.

Users who have used Ubuntu know Ubuntu computer can be used once it opens instead of costing much time to install browser, media player, office suite, and other commonly used software, which promotes the ease of use of the system.

Besides, this operating system provides users with many drives of hardware device. Therefore, Ubuntu is preferred by many Linux fans and has become the best Linux operating system.

However, after you use it for a while, they may find the Ubuntu partitions on the device are unreasonable and want to change the sizes of the partitions. Under this situation, many users don’t know how to resize partition Ubuntu as Ubuntu operating system is different form Windows and some Windows disk partition resizer cannot be used in Ubuntu.

Since Ubuntu and Windows are different operating system platforms, the simplest way to resize Ubuntu partition is that you can resize the Ubuntu partition under Windows if your computer is dual-boot.

It is recommended to use reliable third-party tools to resize Ubuntu partition as Windows built-in Disk Management is much limited when you use its Extend Volume or Shrink Volume to resize partition. See: Why Extend Volume Grayed out and How to Quickly Fix It

Ubuntu Resize Partition

Why Do You Choose MiniTool Partition Wizard Free Edtition

As is known to all, there are many excellent partition managers on the market to help Windows users to resize partitions if there is insufficient space and manage disks and partitions. However, most of them do not support this feature.

Luckily, nowadays, dual booting Linux with Windows is always suggestible for the beginners. For this kind of users, they can resize Ubuntu partition under Windows operating system with a third-party partition manager.

You can choose MiniTool Partition Wizard Free Edition to resize Ubuntu partition or Windows partition as this partition manager won’t damage data on related partitions, and you can manage Windows partition and Ubuntu partition at ease with just one partition manager.

How to Resize Ubuntu Partition with MiniTool Partition Wizard?

Here is a tutorial:

Step 1. Download MiniTool Partition Wizard Free Edition by clicking the following button. Install it on your Windows operating system and launch it to get the main interface.

Step 2. This software will list all partitions on your computer. Then, you need to select the Ubuntu partition that you want to change sizes, and click Move/Resize Partition option from left action panel. You can see from the following image.

How to resize your ubuntu partitions

Step 3. In the following interface, drag the partition handle rightwards or leftwards to extend or shrink partition. Then, click OK to go back to the main interface.

How to resize your ubuntu partitions

Step 3. Next, click Apply to perform the pending operation.

How to resize your ubuntu partitions

Verdict

You see, it is not impossible to resize partition sizes in Ubuntu. If you are an Ubuntu and Windows dual-boot user, you can resize Ubuntu easily with MiniTool Partition Wizard under Windows.

If you have any question about Ubuntu resize partition with MiniTool Partition Wizard, you can leave a message on the following comment zone and we will reply as soon as possible. If you need any help when using MiniTool software, you can contact us via [email protected] .

  • Page History
  • Login to edit

If you wish to create a partition (in which to install Ubuntu Linux, for example) on a hard drive which already contains a Windows partition, or if you need to provide more space in an existing partition that is running out of space, you will need to perform one or more partition resizing operations. You can re-allocate hard drive space from one partition to another, or add previously UnallocatedSpace to a partition.

Resizing Windows Partitions requires special attention and is accomplished in a manner different from that used to resize other types of partitions.

” height=”16″ src=”/moin_static198/light/img/icon_cool.png” title=”Info ” width=”16″ /> When shrinking a partition containing data, attention must be given to the amount of free space left in the partition; especially a Windows partition, but true for any filesystem. The less room left in a partition, the more likelihood of fragmentation of files, and the harder it will be to defragment that partition.

Rule of Thumb: Leave at least 10% free space on any partition to reduce fragmentation and make defragmentation easier.

Note that, in order to expand a partition, you must have free space next to it in which to expand. This can be accomplished either by shrinking another partition next to it, or moving a (or some) partition(s) away from it. See the Moving A Partition page for details on moving a partition.

See notes in Additional Notes on Partitions on the Operating Systems And Primary/Extended Partitions page for additional restrictions on resizing operations.

To resize a partition, first make sure the partition is unmounted. If the partition is mounted, most of the options in the menu will be unavailable, except for one that says “Unmount,” which you should select to unmount the partition.

How to resize your ubuntu partitions

Notice in the image that the partition I am resizing is the Windows NTFS partition that covers the entire hard drive, which I created earlier. A new Windows computer’s hard drive will typically be formatted in this manner; one large partition covering the entire drive.

Once you are sure the partition is unmounted, right click on the partition you wish to resize and select “Resize/Move” from the menu as illustrated above. You will then be presented with the following:

How to resize your ubuntu partitions

Resizing a partition can be done one of two ways:

Dragging and sliding . Position the cursor over the arrow on either side of the graphical bar shown in the screenshot, left click and hold, then drag the arrow; away from the edge for shrinking or towards the edge (into the free space, if available) to expand it.

Changing the “New Size” or the “Free Space Preceding/Following” sizes. This can most easily be done by changing the size of the partition itself. This is done either by using the up/down arrows to the right of the “New Size” window, or by directly editing the size itself in that Window. Alternately, you can shrink the partition by increasing the non-zero side of the partition in either the “Free Space Preceding” or “Free Space Following” window.

If you attempt to expand the partition by decreasing the non-zero side of the partition (“Preceding” or “Following,” depending on where the free space is), it will move the partition instead of increasing it’s size. The same will apply if free space exists on both sides of the partition. See Moving A Partition for details.

After changing the size of the partition, just click the “Resize/Move” button, and the changes will be recorded and visible in a window at the bottom. When you are sure that you have resized it as you desire, you click the “Apply” button at the top and the partition will be resized. Your hard drive will then be as follows:

How to resize your ubuntu partitions

HowtoPartition/ResizingPartition (последним исправлял пользователь ben64 2018-01-15 10:38:20)

Table of Contents

Background

Hyper-V server with fresh Ubuntu installed. Disk was set to 25GB on install, and LVM was chosen.

This procedure works for any Ubuntu file system that has been formatted with LVM, and has also been tested on a Proxmox server.

The guide is quite specific to LVM and Ubuntu and running an actual Virtual Machine guest.

If you’re using Ubuntu and VMWare and you don’t have LVM, you might be able to skip the pvresize command and substitute lvextend with growpart instead. See here. The actual commands for this scenario is:

sudo growpart /dev/sda 2 (your partition number)
sudo resize2fs /dev/sda2

But for now, let’s head back to:

  1. Ubuntu
  2. A virtual machine guest
  3. LVM volume

Issue and How to Do it

Only 3.9 GB available on the root volume. At this point, it’s important to point out that the root volume’s name is /dev/mapper/ubuntu–vg-ubuntu–lv as this will be used in multiple places in this document.

Because LVM was chosen, you are in good luck as LVM partitions can be resized online, so no downtime is required. In fact, even with EXT4 and a VM it’s easy to resize online.

Steps TL;DR

  • fdisk -l (note it’s partition 3 by looking at the current Size)
  • parted
    • resizepart, Fix, 3, 100% (type this instead), quit
  • pvresize /dev/sda3
  • lvextend -l +100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv
  • resize2fs /dev/mapper/ubuntu–vg-ubuntu–lv
  • df -h

Transcript of 50 GB to 100 GB Resizing

If you just want to see how a 50 GB to 100 GB Resizing event goes, scroll to the end of the article.

Complete Steps and Explanation

ssh to server, sudo -i to become root

Confirm there is a limited amount of disk space. In the output below, note the / (root) volume only has 3.9 GB disk space:

Next confirm in Linux that there is actually a lot more space available. As you will see from the output below, there is 24G on the /dev/sda3 volume. The other 1GB is used in the boot volume and the BIOS boot

The one set of instructions referred to starting this process using parted , so parted log is below. The instructions as per Stack read something like:

“First you need to run parted and use its resizepart command to expand the partition to use the whole disk, then run pvresize to tell LVM about the new space, then run lvresize to grow the logical volume, and finally resize2fs on the logical volume to grow the filesystem to use the new space. This can be done without a reboot.”

Please note however I diverted slightly from these steps. The first command I learnt / used in parted, was just used to print the partition information:

This was followed by me checking and re-checking information using fdisk and df -h to make sure I was understanding the current situation.

Then I finally started the procedure:

At this point I tried using lvresize but couldn’t get it to work. It appears there is both lvresize and lvextend . As per the “microhowto.info” article:

“The difference is that lvextend can only increase the size of a volume, whereas lvresize can increase or reduce it.”

The first attempt at specifying 24GB did not work. After I completed the procedure I found that you can also specify a flag 100%, but unfortunately, I didn’t get that information in time and just ended up specifying 23GB. If I have the time I might try and use the 100% flag. For reference, the flag is lvextend -l +100%FREE /dev/VGNAME/LVNAME

Below first attempt but insufficient space:

Second attempt reducing space to allocate:

After lvextend , one has to use resize2fs . This was kind of scary because it appeared I was going to work on a live disk, but it went quick.

TADA! The disk is now 23G big as seen by df-h output below:

Caveats

As a side note, I logged into Hyper-V Manager but could find an easy place to resize the disk. On right click, Inspect, I could however see the disk was 25GB as specified when I installed the VM.

Transcript of 50 GB to 100 GB Resizing

Here is the output of a 50 GB to 100 GB resizing. In this case, the Resize Disk option in Proxmox was chosen.

The console spits out red giving you a heads up that it detected the host has changed the disk size. All commands and important information is in a bold or black font, and all commands or typing is in blue .

Please note a sector is not the same as byte but by analyzing the numbers one can see that an increase is on the way.

References

  • https://askubuntu.com/questions/983890/how-to-allow-partitions-to-dynamically-extend
  • https://www.linuxtechi.com/extend-lvm-partitions/
  • http://www.microhowto.info/howto/increase_the_size_of_an_lvm_logical_volume.html#idp25840
  • http://manpages.ubuntu.com/manpages/trusty/man8/lvresize.8.html
  • https://serverfault.com/questions/692340/how-can-i-tell-pvresize-to-expand-a-physical-volume-to-include-all-available-spa
  • https://www.thegeekdiary.com/centos-rhel-converting-an-existing-root-filesystem-to-lvm-partition/
  • https://www.thegeekdiary.com/centos-rhel-converting-an-existing-root-filesystem-to-lvm-partition/

Interested in More?

If you’re interested in file systems, I learnt a ton by reading this article:

The key take-away from that article and this knowledgebase article is that this article relies on LVM which is not mentioned at all in that article.

More References

File systems can be a complex and wide topic. Here is another article to get your appetite going:

After installing ubuntu can I move it to use a different disk space?

How to resize your ubuntu partitions

3 Answers 3

You can try using GParted. There is a very nice guide to Live USBs and GParted here.

Also, for the partition moving, it could be possible using GParted as well. Make a new partition bigger than your current Ubuntu partition, then use GParted to copy all the data over. This is rather crude, and might not work completely, but with some luck should do the trick.

Yes we can do it, using resize2fs so:

First, we need know about free space:

Now proceed to resize:

So, Well, We need verify our disk, before proceed. So, Its logic:

Now, we need delete our patition, and recover our partition with a new size.

We can use Fdisk, but if our HD is “big”, may be we must use parted.

Ready! Now we have a new partition.

How to resize your ubuntu partitions

You can use gparted or fdisk for that. Finding out the free space to dump the installed one using resize2fs, e2fsck. Use –help for best results.

Here is the example set of commands you may try :

df -h ( To list all your available drives)

resize2fs /dev/sdx xG (replace x with your actual values where xG defines the new disk space that you like to compressed into in GB)

e2fsck -f /dev/sdb (filesystem check to check parity and sync memory) Now start partitioning using fdisk tool :

fdisk -l / Listing all partition details of all available devices

sudo fdisk /dev/sdx /* selecting fdisk tool for sdx device

p /* display present partitions

d (untill no partition exists) /* deleting existing partitions

n /* Creating new partitions

p /* selecting partiton as primary

1 /* giving partition number

(default) /* offset byte

(select size) /* needed partition size */

w /* write changes */

sudo mkfs.(filesystem type) /dev/sdx1 /* format the new partition as a file system type */

I seem to have made a little mistake I installed windows xp pro and Ubuntu

anyhow when installing I messed up the sizes ended up with xp taking 90% of the drive up, anyhow I booted from the live disk and shrunk the xp partition using gparted, however it won’t let me enlarge the ubuntu partition, here’s a screenshot of the area, anyhow help asap would be appreciated

I wrote this guide for expanding / by taking space from Windows:
Expanding an Ubuntu System Partition

It was for failed installs that created only a 2.5GB / partition, which looks like what happened to you. There are also instructions for how to reinstall and prevent it from happening again if you prefer to do it that way.

Your situation is a bit easier since you already have unallocated space, so you can skip a step or two.

I wrote this guide for expanding / by taking space from Windows:
Expanding an Ubuntu System Partition

It was for failed installs that created only a 2.5GB / partition, which looks like what happened to you. There are also instructions for how to reinstall and prevent it from happening again if you prefer to do it that way.

Your situation is a bit easier since you already have unallocated space, so you can skip a step or two.

the problem is it won’t let me resize the ubuntu partition it just doesn’t show that as an option, it stays faded out when I have ubuntu partition area selected and it’s showing a key in the area next to it, I’m not sure what that means

You will have to work with the extended partition first.

How to resize your ubuntu partitions

When you decide to resize your Ubuntu partition you can not do it while it is in use. Whether you want to enlarge it or split it into several parts, you will require an Ubuntu live CD or USB drive to edit partitions on your system. The live CD includes a GParted partition editor, which helps you modify your partitions. This GParted is a compact complete package graphical partition editor that works as a frontend to a numerous kind of Linux terminal commands. Let’s discuss few steps to increase partition size of Ubuntu.

Boot from CD or USB drive

As a basic step, you can try this method to increase partition size of Ubuntu. You can use the CD or USB drive which you have used to install Ubuntu. Insert it into your system and then restart it to perform initial functions. If you do not have CD or USB drive, you can create a new Ubuntu live media. For that, you need to go Ubuntu official website and download an Ubuntu ISO from it, burn this ISO file on your disk by right-clicking the download ISO file option and choosing Write to Disc.

If you are using USB drive to perform the task, you can use Startup Disk Creator application. This is available with Ubuntu and you can find right it in the Dash.

Provide this Startup Disk Creator app with an Ubuntu ISO file and a USB drive, which will create a live USB drive to use.

Once you have created this live media on CD or USB flash drive insert it into your system and restart your computer. It will start your live media to perform an action. If your live media does not work properly, try to enter your system’s BIOS and change its boot order. You can access the BIOS on your system by pressing the key (often Delete, F1 or F2) that appears on your system while booting.

Using GParted

GParted is a Gnome-based partition manager which performs best as a LiveCD or live-USB. GParted partition does not come pre-installed by default on an Ubuntu system. It can be included with Ubuntu live environment. Further, you can launch it from the Dash to start it working.

If your system has more than one hard drive, you need to select the appropriate one by going to drop-down box at the top right corner of the GParted window.

How to resize your ubuntu partitionsYou can also take help from GParted to increase disk partition

Your system displays a key icon in front of partitions which are in use and they can’t be modified. You can unmount the mounted partition by clicking the eject button in the file manager. If your system has a swap partition, it will likely be activated by Ubuntu live environment. You right-click and select Swapoff to deactivate the swap partition.

To resize a selected partition, right-click it and select Resize/Move.

The simplest way to resize your partition is to click and drag the handles to either side of the bar. You can also enter exact numbers to resize it. You can shrink any partition if it has a free space to enlarge other. Changes you make will not take immediate effect as they can be queued up and appears in a list manner at the bottom part of the GParted window.

Once you have free up space by shrinking other partitions you can use this unallocated space to create a new partition. To do it, right-click on the unallocated space and select New. It will walk you through creating a new partition.

You can right-click on adjacent unallocated space and select Resize/Move to enlarge the partition. You can specify the partition size by clicking and dragging the sliders or can enter the exact number into the boxes. When you are finished click on the Green check mark icon on the GParted’s toolbar to apply changes. By this way, GParted will apply all queued up changes. You can finally restart the computer and remove the CD or USB flash drive.

You can apply these simple steps to resize partition size of Ubuntu. These steps can solve your partition related issues effortlessly. In fact, this way you can enlarge or split your partitions in the easiest manner.

To sum up, increasing partition size on Ubuntu is a crucial task to perform but helps you improve the system performance significantly. We have here discussed certain steps to help you resize your partition size of Ubuntu.

How to resize your ubuntu partitions

Sometimes you may want to increase your disk space and partition capacity in Linux. For example, in VMware or VirtualBox or even ESXi, you gave the extra capacity to your Linux and Linux recognizes that extra space as unallocated. You do not want to create a new partition but you want to increase the partition that has limited space. In this article, we are going to teach you step by step How to resize root partition on Linux Ubuntu and Debian. It should be noted that you can visit the packages available in Eldernode if you want to buy a Linux VPS server.

Table of Contents

How to resize root partition on Linux Ubuntu and Debian

The method we are going to teach you in this article works on most Linuxes, including Ubuntu, Debian, and so on. So in the continuation of this tutorial, join us to introduce you to the Tutorial resize root partition on Linux Ubuntu and Debian.

What is a root partition?

The most important reason for partitioning is the optimal use of hard disk space and easier and faster access to classified information. You need to know that all the programs and software that you will later install on your system will be in the root partition. In fact, other directories related to the Linux file system will be placed as subdirectories within this partition. In other words, it is the storage location of the entire operating system. Like the partition, you install Windows into. In the next section, we will teach you how to Resize root partition on Linux Ubuntu and Debian. Please join us.

Resize root partition on Linux Ubuntu and Debian

In this section, we want to teach you how to resize the root partition on Linux Ubuntu. To do this, just follow the steps below. The first step is to expand the components of the file system. It should be noted that in this tutorial, the virtual machine disk size in VMware will increase from 18 GB to 28 GB.

Physical Volume >> Volume Group >> Logical Volume >> Filesystem

In the first step, it is necessary to see the current state of the physical volume. Therefore it is necessary to execute the following command:

After executing the above command, you will see the following image:

How to resize your ubuntu partitions

Now you need to manipulate the disk partition table in the next step using the following command:

After executing the above command, you will see the following output. You must accept the default values provided to return the “n” option at this point.

How to resize your ubuntu partitions

Now you need to use the reboot command to apply the changes:

In the next step you need to update the partition table using the following command:

Then you have to select [NEW] partition and [PRIMARY] in the next step to determine the type of partition. You also need to select and enter the desired partition size. Finally, you need to select [WRITE] to save the changes you have made. You must then save [QUIT].

Note: The new partition you created may be likely /dev/sda1.

How to resize your ubuntu partitions

You can now start the newly created partition by running the following command:

It’s time to add the newly created partition to the root volume group. You will need to first run the pvdisplay again to display new physical volume details. You can see the new partition as shown below:

How to resize your ubuntu partitions

After you have been able to successfully complete the above steps, you should now use the following command and get the name of your volume group:

You should expand the volume group and then verify your volume group again once complete using the following commands:

It should be noted that you must expand the Logical Volume using the lvextend command:

How to resize your ubuntu partitions

Finally, expand the Filesystem with the following commands to fill the logical volume:

How to resize your ubuntu partitions

Conclusion

Before performing the method mentioned in this tutorial, it is better to make a backup or snapshot of your data or operating system. Because one wrong move can cause you to lose your data. In this article, we tried to teach you to step by step how to resize root partition on Linux Ubuntu and Debian.

  • 4438
  • 1430
  • Gary Hamill
  1. How do I resize a partition on Ubuntu hard drive?
  2. Can a partitioned hard drive be partitioned?
  3. How do I partition my hard drive after installing Ubuntu?
  4. How do I resize a partition in Linux?
  5. Can I resize Linux partition from Windows?
  6. Does partitioning a drive make it slower?
  7. Should I partition my 1TB SSD?
  8. What is the best way to partition a 1TB drive?
  9. What partitions do I need for Ubuntu?
  10. How Big Should Linux root partition be?
  11. How do I split a partition in Ubuntu?

How do I resize a partition on Ubuntu hard drive?

To resize a partition, right-click it and select Resize/Move. The easiest way to resize a partition is by clicking and dragging the handles at either side of the bar, although you can also enter exact numbers. You can shrink any partition if it has free space. Your changes won’t take effect immediately.

Can a partitioned hard drive be partitioned?

Every hard drive in use has at least one partition. You can shrink that partition and create new ones out of the extra space. You’ll find this useful if you want to install more than one operating system, or if you want to truly separate programs and data.

How do I partition my hard drive after installing Ubuntu?

How to Create a Separate Home Partition After Installing Ubuntu

  1. Step 1: Create a New Partition. If you have some free space, this step is easy. .
  2. Step 2: Copy Home Files to New Partition. .
  3. Step 3: Locate the New Partition’s UUID. .
  4. Step 4: Modify the fstab File. .
  5. Step 5: Move Home Directory & Restart.

How do I resize a partition in Linux?

Procedure

  1. Unmount the partition: .
  2. Run fdisk disk_name. .
  3. Check the partition number you wish to delete with the p. .
  4. Use the option d to delete a partition. .
  5. Use the option n to create a new partition. .
  6. Check the partition table to ensure that the partitions are created as required using the p option.

Can I resize Linux partition from Windows?

To resize your Windows partition, right-click on the Start menu if you run Windows 10 or open the Start menu and right-click on Computer if you run an older version. Then, pick Disk Management. Now, right click on the partition you want to change, and choose Shrink or Grow depending on what you want to do.

Does partitioning a drive make it slower?

Partitions can increase performance but also slow down. As jackluo923 said, the HDD has the highest transfer rates and the fastest access times on the outeredge. So if you have a HDD with 100GB and create 10 partitions then the first 10GB is the fastest partition, the last 10GB the slowest.

Should I partition my 1TB SSD?

SSDs are generally recommended not to partition, in order to avoid wasting of storage space due to partition.

What is the best way to partition a 1TB drive?

The best way to partition any disk is:

  1. OS: if it’s the system disk, let the operating system partition it during the installation of the operating system, taking up the entire disk,
  2. DATA: if it’s a supplemental data disk, the just partition it as one volume.

What partitions do I need for Ubuntu?

For new users, personal Ubuntu boxes, home systems, and other single-user setups, a single / partition (possibly plus a separate swap) is probably the easiest, simplest way to go. However, if your partition is larger than around 6GB, choose ext3 as your partition type.

How Big Should Linux root partition be?

Root partition (always required)

Description: the root partition contains by default all your system files, program settings and documents. Size: minimum is 8 GB. It is recommended to make it at least 15 GB. Warning: your system will be blocked if the root partition is full.

How do I split a partition in Ubuntu?

Here are the steps:

  1. Boot with Ubuntu Live CD/DVD/USB,
  2. Start GParted, select the partition you want to resize (here, that would be your Ubuntu root partition), [if you have a swap partition, switch it off; also if you have some mounted partitions, an unmount might be necessary]
  3. From the Partition menu select Resize/Move,

Chris Hoffman is Editor-in-Chief of How-To Geek. He’s written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times and Reader’s Digest, been interviewed as a technology expert on TV stations like Miami’s NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times—and that’s just here at How-To Geek. Read more.

How to resize your ubuntu partitions

Ubuntu’s installer offers an easy “Use LVM” checkbox. The description says it enables Logical Volume Management so you can take snapshots and more easily resize your hard disk partitions — here’s how to do that.

LVM is a technology that’s similar to RAID arrays or Storage Spaces on Windows in some ways. While this technology is particularly useful on servers, it can be used on desktop PCs, too.

Should You Use LVM With Your New Ubuntu Installation?

The first question is whether you even want to use LVM with your Ubuntu installation. Ubuntu makes this easy to enable with a quick click, but this option isn’t enabled by default. As the installer says, this allows you to resize partitions, create snapshots, merge multiple disks into a single logical volume, and so on — all while the system is running. Unlike with typical partitions, you don’t have to shut down your system, boot from a live CD or USB drive, and resize your partitions while they aren’t in use.

To be perfectly honest, the average Ubuntu desktop user probably won’t realize whether they’re using LVM or not. But, if you want to do more advanced things later, LVM can help. LVM is potentially more complex, which could cause problems if you need to recover your data later — especially if you’re not that experienced with it. There shouldn’t be a noticeable performance penalty here — LVM is implemented right down in the Linux kernel.

How to resize your ubuntu partitions

Logical Volume Management Explained

We’re previously explained what LVM is. In a nutshell, it provides a layer of abstraction between your physical disks and the partitions presented to your operating system. For example, your computer might have two hard drives inside it, each 1 TB in size. You’d have to have at least two partitions on these disks, and each of these partitions would be 1 TB in size.

LVM provides a layer of abstraction over this. Instead of the traditional partition on a disk, LVM would treat the disks as two separate “physical volumes” after you initialize them. You could then create “logical volumes” based on these physical volumes. For example, you could combine those two 1 TB disks into a single 2 TB partition. Your operating system would just see a 2 TB volume, and LVM would deal with everything in the background. A group of physical volumes and logical volumes is known as a “volume group.” A typical system will just have a single volume group.

This layer of abstraction makes it possibly to easily resize partitions, combine multiple disks into a single volume, and even take “snapshots” of a partition’s file system while it’s running, all without unmounting it.

Note that merging multiple disks into a single volume can be a bad idea if you’re not creating backups. It’s like with RAID 0 — if you combine two 1 TB volumes into a single 2 TB volume, you could lose important data on the volume if just one of your hard disks fails. Backups are crucial if you go this route.

Graphical Utilities for Managing Your LVM Volumes

Traditionally, LVM volumes are managed with Linux terminal commands.These will work for you on Ubuntu, but there’s an easier, graphical method anyone can take advantage of. If you’re a Linux user used to using GParted or a similar partition manager, don’t bother — GParted doesn’t have support for LVM disks.

Instead, you can use the Disks utility included along with Ubuntu for this. This utility is also known as GNOME Disk Utility, or Palimpsest. Launch it by clicking the icon on the dash, searching for Disks, and pressing Enter. Unlike GParted, the Disks utility will display your LVM partitions under “Other Devices,” so you can format them and adjust other options if you need to. This utility will also work from a live CD or USB drive, too.

How to resize your ubuntu partitions

Unfortunately, the Disks utility doesn’t include support for taking advantage of LVM’s most powerful features. There’s no options for managing your volume groups, extending partitions, or taking snapshots. You could do that from the terminal, but you don’t have to. Instead, you can open the Ubuntu Software Center, search for LVM, and install the Logical Volume Management tool. You could also just run the sudo apt-get install system-config-lvm command in a terminal window. After it’s installed, you can open the Logical Volume Management utility from the dash.

This graphical configuration tool was made by Red Hat. It’s a bit dated, but it’s the only graphical way to do this stuff without resorting to terminal commands.

Let’s say you wanted to add a new physical volume to your volume group. You’d open the tool, select the new disk under Uninitialized Entries, and click the “Initialize Entry” button. You’d then find the new physical volume under Unallocated Volumes, and you could use the “Add to existing Volume Group” button to add it to the “ubuntu-vg” volume group Ubuntu created during the installation process.

How to resize your ubuntu partitions

The volume group view shows you a visual overview of your physical volumes and logical volumes. Here, we have two physical partitions across two separate hard drives. We have a swap partition and a root partition, just as Ubuntu sets up its partitioning scheme by default. Because we’ve added a second physical partition from another drive, there’s now a good chunk of unused space.

How to resize your ubuntu partitions

To expand a logical partition into the physical space, you could select it under Logical View, click Edit Properties, and modify the size to grow the partition. You could also shrink it from here.

How to resize your ubuntu partitions

The other options in system-config-lvm allow you to set up snapshots and mirroring. You probably won’t need these features on a typical desktop, but they’re available graphically here. Remember, you can also do all of this with terminal commands.

  • Open with Desktop
  • View raw
  • Copy raw contents Copy raw contents

Copy raw contents

Copy raw contents

This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters

$ Title_HTML = ‘How to Resize Partitions with the Ubuntu or GParted Live CD’ ;
$ Title_Plain = $ Title_HTML ;
$ Description_HTML = ‘Having installed Ubuntu, you may find yourself wanting to shrink or get rid of your Windows partition completely. This tutorial will show you how do do either of those things, with a variety or filesystems, including NTFS, and EXT4. The instructions do not vary based on filesystem format.’ ;
$ Description_Plain = $ Description_HTML ;
$ Keywords = ‘resize partitions live cd dvd usb gparted’ ;
$ Featured_Image = ” ;
$ Canonical = ‘how-to-resize-partitions-with-the-ubuntu-or-gparted-live-cd’ ;
$ Post_Type = ‘Blog Post’ ;
$ Post_Category = ‘Boot’ ;
require_once __DIR__. ‘/../request.php’ ;
if ( $ Request [ ‘path’ ] === $ Place [ ‘path’ ]. $ Canonical ) <
require ‘../header.php’ ;
?>
h2 > How to Resize Partitions with the Ubuntu or GParted Live CD h2 >
p > Having installed Ubuntu, you may find yourself wanting to shrink or get rid of your Windows partition completely. This tutorial will show you how do do either of those things, with a variety or filesystems, including NTFS, and EXT4. The instructions do strong > not strong > vary based on filesystem format. p >
div class =” section group ” >
div class =” col span_5_of_11 ” >
div class =” info ” >
p > Consider disabling System Protection and Pagefile on Windows (if you are running out of space there too, both can use a lot of space but protect and speed up Windows). p >
div >
br >
div class =” warning ” >
p > Make a Backup of as much as possible if you have the space on an external drive, usb, or cd/dvd. p >
div >
br >
ol >
li > Boot either a a href =” https://www.ubuntu.com/download ” target =” _blank ” > Ubuntu a > or a href =” https://gparted.sourceforge.io/livecd.php ” target =” _blank ” > GParted Live CD a > . li >
li > Open GParted. li >
li > Right-click on the partition you wish to shrink. li >
li > Select Resize. li >
li > Shrink or Delete the target partition (make sure you leave at least a couple of GB for an OS to play with, especially Windows, unless you’re deleting it completely). li >
li > Click Apply (tick at the right of the icons along the top, this might take a while, and you can’t undo or stop it half-way through). li >
li > Right-click on your Ubuntu Partition. li >
li > Expand into all the free space. li >
li > Click Apply again. li >
ol >
div >
div class =” col span_1_of_11 ” > br > div >
div class =” col span_5_of_11 ” >
a href =” assets/images/how-to-resize-partitions-with-the-ubuntu-or-gparted-live-cd/Screenshot-from-2012-06-04-195206.png ” title =” GParted is a nice way to Manage Partitions ” > img src =” assets/images/how-to-resize-partitions-with-the-ubuntu-or-gparted-live-cd/Screenshot-from-2012-06-04-195206.png ” alt =” GParted is a nice way to Manage Partitions ” title =” GParted is a nice way to Manage Partitions ” > a >
div >
div >
div class =” warning ” >
p > This could take a fair while to shift things about, so make sure you’re plugged in and don’t shut a laptops lid (the Ubuntu Live CD will go to sleep). You may want to disable screen locking and sleeping after a certain time on the Ubuntu Live CD under Power Options. p >
div >
br >
div class =” info ” >
p > if you have modified a partition containing Microsoft Windows, it might run a disk check when next started, this is normal behavior, it should finish and reboot. Boot into Windows before accessing the Windows partition from Ubuntu. p >
div >
br >
h3 > Congratulations, you’ve successfully resized your partitions! h3 >
require ‘../footer.php’ ; > ?>
  • Copy lines
  • Copy permalink
  • View git blame
  • Reference in new issue

Hey, last night I installed jaunty just to sort of check it out. But as I was only sort of “checking it out”, because my partition is very cluttered, I only gave it about 6/7 GB.

Now however I want to give it tons more space. But how.

I have space to spare on ubuntu and vista (especially vista), and I want to re-size my partition.

But I don’t know how :s.

Please help, i’ve been tearing my hair out all day.

I would suggest using Vista’s disk management software to resize it’s partition first, then use gparted to resize your Ubuntu partition. Boot the LiveCD then go to System–>Administration–>Partition Editor and resize the partitions. Make sure you backup important data first.

I would suggest using Vista’s disk management software to resize it’s partition first, then use gparted to resize your Ubuntu partition. Boot the LiveCD then go to System–>Administration–>Partition Editor and resize the partitions. Make sure you backup important data first.

+1! I’ve found it’s always best to use Vista’s own partitioning tools to resize Vista’s partitions. This should give you a general idea of “how to”:

As far as resizing and/or moving Ubuntu partitions you’ll first want to make a plan. If you haven’t already done so install gparted either from Synaptic or go to terminal and:

sudo apt-get install gparted

then go to System > Administration > Partition Editor. Now, you won’t want to use that to do any resizing because partitions will be mounted – for that you’ll want to use your Ubuntu Live CD!

Anyway, with gparted installed you could post a screenshot:

You can see in mine that:
sda1 = XP
sda2 = an extended partition that contains all of my Linux OS’s
sda5 = Hardy
sda6 = SWAP (shared by all Linux OS’s)
sda7 = Jaunty /
sda8 = Jaunty home
sda9 = Mint 6 /
sda10 = Mint 6 home

There are a few basic things to consider:
(1) You can’t exceed the 4 primary partition limit! Thus the need for an extended partition.
(2) Resizing or moving SWAP will result in some UUID problems – easy to deal with but you should be prepared.
(3) Don’t “paint yourself in a corner”! Look here:

(4) Back up! Gparted is great and I’ve had very few problems, but things can go wrong! Such as a power outage in the middle of repartitioning!

+1! I’ve found it’s always best to use Vista’s own partitioning tools to resize Vista’s partitions. This should give you a general idea of “how to”:

As far as resizing and/or moving Ubuntu partitions you’ll first want to make a plan. If you haven’t already done so install gparted either from Synaptic or go to terminal and:

sudo apt-get install gparted

then go to System > Administration > Partition Editor. Now, you won’t want to use that to do any resizing because partitions will be mounted – for that you’ll want to use your Ubuntu Live CD!

Anyway, with gparted installed you could post a screenshot:

You can see in mine that:
sda1 = XP
sda2 = an extended partition that contains all of my Linux OS’s
sda5 = Hardy
sda6 = SWAP (shared by all Linux OS’s)
sda7 = Jaunty /
sda8 = Jaunty home
sda9 = Mint 6 /
sda10 = Mint 6 home

There are a few basic things to consider:
(1) You can’t exceed the 4 primary partition limit! Thus the need for an extended partition.
(2) Resizing or moving SWAP will result in some UUID problems – easy to deal with but you should be prepared.
(3) Don’t “paint yourself in a corner”! Look here:

(4) Back up! Gparted is great and I’ve had very few problems, but things can go wrong! Such as a power outage in the middle of repartitioning!

run gparted on LiveCD.

you cannot resize your partition while the OS is writing data to it.

run gparted on LiveCD.

you cannot resize your partition while the OS is writing data to it.

Did you read the part in bold print where I said, “Now, you won’t want to use that to do any resizing because partitions will be mounted – for that you’ll want to use your Ubuntu Live CD!”

I’ve got a virtual Ubuntu 18.04 server which is running low on disk space. As this is a virtual server I increased the hard disk size in vSphere. I can see the free space in cfdisk but am unsure how to expand the filesystem partition to take advantage of the new space. I can see there is a resize option for the partition but I’m unclear on whether or not that will also format the partitions and lose my data. Bit of a linux n00b, any help would be greatly appreciated.

cfdisk output:

3 Answers 3

For the n00b: Connect with X forwarding enabled ( ssh -X yourserver ), install gparted and use the user-friendly GUI to resize /dev/sda2 .

A more advanced user would probably fire up parted /dev/sda , then enter resizepart 2 . The end of the partition will automatically be selected to match the end of the disk. This will only resize the partition, though. The file-system can be resized to span the whole partition with the appropriate tool, like resize2fs /dev/sda2 for ext2/3/4.

As an additional note: In this case (free space after the end of the partition which will be resized) it should be possible to resize the partition by:

You can install growpart by installing the package: cloud-guest-utils .

Just as a note: There is always a risk of losing data when performing this kind of operations on disks/partitions.

I was seeking to do the same as the OP. My only difference is that I am using Ubuntu 20.04 LTS server.

I had not tried cfdisk yet to see such info (I tried df and lsblk ), so I went ahead and ran cfdisk .

I was surprised that cfdisk itself had an option to [Resize] my disk right there. No need to use other tools, I just went and navigated to my sda, and selected the [Resize] Option. Including a screenshot for reference:

How to resize your ubuntu partitions

Of course now one has to resize the actual filesystem, etc.. I didn’t recall exactly how to do it, but I did remember that I wrote an answer here a month ago where I summed up such steps (sharing it in case it helps someone else) https://askubuntu.com/a/1393329/658154

Basically resize the Physical Volume ( pvresize ), and then resize the Logical Volume ( lvextend ) to finally resize the filesystem ( resize2fs ).

In this article, we will overview how to resize a partition in a Linux. We will use only built-in tools and commands.

Before you begin with partitions, make sure you have a solid backup. Once data is deleted it cannot be undeleted. Build an effective backup strategy for your Linux system: download our free

The primary way of resizing drive partitions in Linux is to delete the old one and create a new one, using the previous starting sector (you can think about it like “left bound of the new partition”). Then you need to simply modify the file system properties to fit the new bounds. If done carefully, you will not lose your data on the modified element, despite the frightening phrase “delete the partition”.

Preparation

Linux has built-in tools (commands) to work with partitions:

  • df / lsblk – allows you to list available drives, including block devices.
  • mount / umount – simple tools allowing you to detach a partition to change its properties.
  • fdisk – management tool. It will recreate partitions with newly specified bounds.
  • e2fsck – allows checking of the modified file system for errors.
  • resize2fs – modifies existing file system to fit new size bounds.

In this example, we are going to use Ubuntu Server 14 as an instance in Amazon EC2 cloud. So, the disk we are working with is a block EBS device called /dev/xvdb.

Note: depending on your Linux distribution and available storage devices, volume and drive names can be different. You have also use the sudo command if your current account doesn’t have “root” privileges.

  • Best practices in system setup and management
  • Ways to properly secure your Linux system
  • Guide to optimal file structure organization

How to resize your ubuntu partitions

Shrinking or Extending Linux Partition

First of all, let’s find the partition we want to resize. Use df -h command to list available elements:

How to resize your ubuntu partitions

The last line contains the device /dev/xvdb1 – it is our working partition. Note that there are actually 2 names:

How to resize your ubuntu partitions

  • /dev/xvdb – it is whole device.
  • /dev/xvdb1 – one partition allocated on /dev/xvdb device.

You can check it using, for example, the lsblk tool (for block-level devices only):

I have created the file file_should_remain.test to check whether the partition did not lose its data

We need to unmount the volume before modifications – just run the umount command, where mounting point is a file system’s representation of the device. And don’t forget sudo to get appropriate permissions:

command” width=”599″ height=”33″ srcset=”/wp-content/uploads/2018/04/Linux-partition-resize-4.png 599w, /wp-content/uploads/2018/04/Linux-partition-resize-4-300×17.png 300w” sizes=”(max-width: 599px) 100vw, 599px” />

Now run fdisk command with our test disk name as an argument and then type “p” to print the list:

How to resize your ubuntu partitions

The last line contains important info about the current partition size and its bounds: “Start” and “End”. Remember “Start” value (2048 in this example). Now delete this partition by typing “d” and then type “w” to save these modifications:

How to resize your ubuntu partitions

After the old partition is removed we need to create the new one, either a bigger or smaller size. The following procedure is the same for both actions, but keep in mind that:

  • You can extend the partition only to the space available at the “right” side. Simply saying, free space should be at the end of the resizing.
  • You cannot shrink the current element to a size smaller than the actual data stored.
  • It is a must to specify the same starting point as the previous partition while creating the new one. Otherwise, you may lose your data!

In our example, the new partition will be a smaller size so the Shrink operation will be performed. Let’s run fdisk again and type “n” – creating the new one:

How to resize your ubuntu partitions

You may use default values in most fdisk questions, but carefully check these highlighted on the picture above: first sector (starting point) and last sector. You can use the + G format to specify the desired partition size in Gigabytes (use “M” for Megabytes). Finish by typing “w” to save changes.

Now we need to verify consistency by running e2fsck:

How to resize your ubuntu partitions

Note the highlighted line – the tool shows that there is a mismatch in the file system configuration and current size. This is due to shrinking the partition with no changes made to the file system metadata. Just answer “no” to continue checking.

Let’s fix the error using resize2fs and then check the filesystem again:

How to resize your ubuntu partitions

Now the file system block size is the same as for partition configuration. Finally, let’s mount the resized volume and check that our data is still here:

How to resize your ubuntu partitions

As you can see, our test file is still here and the partition has a new size.

Conclusion

That’s it. Now you have fresh-new partitions. If you have any questions or comments regarding the article, let us know.

Leverage AWS, Wasabi, Backblaze B2, and local storage. Eliminate expensive hardware investments. Improve recovery time objectives.

In this tutorial we will learn how to extend the partition of the disk on Ubuntu to remove the error which is occurring because of the full disk and no free space.

How to extend partitions to fill disks on Ubuntu using gparted

We cannot modify the partition if it is in use. If we want to modify the partition either we use the Ubuntu live CD or bootable USB drive. We will here discuss the modification using gparted but as we know gparted is not included by default so we will follow the following procedure to extend the partition to fill disks on Ubuntu, we will first open the Ubuntu and check the already allocated space on the disk. For this purpose, we will open the terminal and update our repository:

We can make changes with the disk management or with disk partitions using “gparted” application. To use it, first we have to install the package of gparted by the following command:

How to resize your ubuntu partitions

After the installation of the gparted package, we will open the gparted using:

How to resize your ubuntu partitions

A dialogue box will open as shown in the figure, we will change the size of the “New Partition # 1 ”:

How to resize your ubuntu partitions

We will right click on the “New Partition #1” and click on the “Resize/Move”:

How to resize your ubuntu partitions

Another dialogue box opens with the size details of the disk or partitions:

How to resize your ubuntu partitions

For example, to extend the size of the partition we will change size by typing from 21919 to 41920 and also click on the “Resize/Move” button to confirm changes:

How to resize your ubuntu partitions

We can also change the size by scrolling the bar present in the top to the left or right:

How to resize your ubuntu partitions

How to extend partition to fill disk on Ubuntu on Virtual Machine (VirtualBox)

If you are using the Ubuntu on the VM (Virtual Machine) and you want to change the partition size of the Ubuntu then the procedure will be like first you will open the VM as:

How to resize your ubuntu partitions

Choose the Ubuntu or the operating system you are going to run on the VM:

How to resize your ubuntu partitions

Click on the “Settings” icon:

How to resize your ubuntu partitions

A popup dialogue box will open as:

How to resize your ubuntu partitions

Click on the “System”, a menu will be opened to assign the size to the partition by either typing the size or moving the cursor on the bar. Then finally click on the OK button in order to save the modifications.

How to resize your ubuntu partitions

Conclusion

Occasionally while working on the system we face memory full error. To avoid or tackle such errors we have options either to delete the data stored previously in the drive or to make space free or to extend the partition. In this tutorial we discussed how to rectify the error of memory space issue by extending the partition. We have discussed the two methods to extend or increase the partition; one is by the command line method in Ubuntu and the other is if you are using Ubuntu in the virtual machine. Hope this tutorial will help you to find out how to extend the partition to fill the disk on Ubuntu.

About the author

How to resize your ubuntu partitions

Hammad Zahid

I’m an Engineering graduate and my passion for IT has brought me to Linux. Now here I’m learning and sharing my knowledge with the world.

I would second using GParted. I’ve always used SysrescCD Live CD (http://www.sysresccd.org/Main_Page) . it has always worked well for me.

there are a couple things you’ll need to know, if you use GParted in SysRescueCD .

1) it will start you at a command prompt. You can load a gui by typing “startx” if that doesn’t work, there is another command you can enter (can’t remember right now) that is printed on the screen after booting. It’ll give you the option to choose the resolution manually before the gui (graphic user interface) loads.

2) you will probably need to resize your windows partition first. and then use the space you free up from that partition to resize your ubuntu partition. GParted let’s you do all of this at once. BUT it’s VERY important to let Windows XP load after you resize your windows partition. When Windows XP does load it’ll see that something is wrong with the disk and will run “chkdsk” on a light blue screen at startup. You really need to let chkdsk run entirely for your Windows XP partition to work with the new partition size. After you let windows do this, you can restart the PC and load back into ubuntu. your new space should be ready for use.

3) if you need to use the internet in SysrescueCD live environment, you’ll have to type something like “dhcpc” (can’t remember the exact command) to get an IP address from your server for internet access.

ok, before i do anything, here is what came when i did what you said:

$ sudo fdisk -l
[sudo] password for phani:

Disk /dev/sda: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xd0f4738c

Device Boot Start End Blocks Id System
/dev/sda1 1 4 32098+ de Dell Utility
/dev/sda2 * 5 7928 63649530 7 HPFS/NTFS
/dev/sda3 9367 9725 2883667+ db CP/M / CTOS / .
/dev/sda4 7929 9366 11550735 5 Extended
/dev/sda5 7929 9299 11012526 83 Linux
/dev/sda6 9300 9366 538146 82 Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdb: 1015 MB, 1015808000 bytes
32 heads, 63 sectors/track, 984 cylinders
Units = cylinders of 2016 * 512 = 1032192 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 1 984 991747+ 6 FAT16
[email protected]:

$ sudo blkid
/dev/sda1: SEC_TYPE=”msdos” LABEL=”DellUtility” UUID=”07D4-0C02″ TYPE=”vfat”
/dev/sda2: UUID=”7ED8CA3BD8C9F187″ TYPE=”ntfs”
/dev/sda3: LABEL=”DellRestore” UUID=”0000-0000″ TYPE=”vfat”
/dev/sda5: UUID=”544dd0b5-206a-40e3-8bd3-77685021ab90″ TYPE=”ext3″
/dev/sda6: TYPE=”swap” UUID=”21789cd1-3eac-4c65-a7e2-6a10b5f2712b”
/dev/sdb1: SEC_TYPE=”msdos” LABEL=”KODAK” UUID=”0000-0000″ TYPE=”vfat”
[email protected]:

$ cat /etc/fstab
# /etc/fstab: static file system information.
#
#

proc /proc proc defaults 0 0
# /dev/sda5
UUID=544dd0b5-206a-40e3-8bd3-77685021ab90 / ext3 relatime,errors=remount-ro 0 1
# /dev/sda6
UUID=21789cd1-3eac-4c65-a7e2-6a10b5f2712b none swap sw 0 0
/dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0
[email protected]:

$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 11G 9.6G 304M 97% /
tmpfs 500M 0 500M 0% /lib/init/rw
varrun 500M 304K 500M 1% /var/run
varlock 500M 0 500M 0% /var/lock
udev 500M 2.8M 498M 1% /dev
tmpfs 500M 144K 500M 1% /dev/shm
lrm 500M 2.0M 498M 1% /lib/modules/2.6.27-11-generic/volatile
[email protected]:

Another good option is Parted Magic (http://www.partedmagic.com) – its essentially GParted with a few other options like Web Surfing.

Just be careful! If your not careful you can do some damage and lose data by partitioning. If your totally new to GParted / PartedMagic check out the tutorials here: http://gparted.sourceforge.net/documentation.php

ok, i downloaded GParted, but now i cant burn it on a CD. My computer has 2 CD drives, 1 read only and 1 RW drive. The R only drive opens fine, but i cant get the tray open for the RW drive ;(. How do i get it to open? Pressing the button on the computer doesnt work.

EDIT: Ubuntu installed GParted, and it runs fine, can i resize from inside ubuntu?

yup drives r full.

to do partitioning you need to be able to boot from the cd drive, preferably the one that writes so you can burn a cd. the rw needs to be the first drive on the cable set as master. this is so u can write to the drive while using the live cd.

burn gparted to a cd, then boot the cd, you cant partition a mounted drive this is why u need either a live cd or the partitioner on a bootable cd.

you are gonna probably need advanced super grub to set up everything that needs to boot.

and knoppix is a great live cd for troubleshooting/editing and fixing pcs
knoppix comes with both partitioners which is handy if and when one or the other partitioner fails.

you really should back up all precious data first.
with that said, partitioning usually preserves all data, but there are instances where it screws a drive, powerfail, user error.

see my post about knoppix and failed partitioning. back up all important stuff and then it don’t matter what happens.

Last Updated: 29th October, 2021

  1. You installed Ubuntu on a 500 GB partition.To resize that partition,you need to boot ubuntu live disk.
  2. After booting ubuntu live disk,open gparted.
  3. Right-click on the 500 GB partition and then resize it.
  4. After resizing an unallocated space was created.

Subsequently, one may also ask, how do I resize my Ubuntu partition?

How to Resize Partitions with the Ubuntu or GParted Live CD

  1. Boot either a Ubuntu or GParted Live CD.
  2. Open GParted.
  3. Right-click on the partition you wish to shrink.
  4. Select Resize.
  5. Shrink or Delete the target partition (make sure you leave at least a couple of GB for an OS to play with, especially Windows, unless you’re deleting it completely).

Similarly, how do I partition after installing Ubuntu? How to Create a Separate Home Partition After Installing Ubuntu

  1. Step 1: Create a New Partition. If you have some free space, this step is easy.
  2. Step 2: Copy Home Files to New Partition.
  3. Step 3: Locate the New Partition’s UUID.
  4. Step 4: Modify the fstab File.
  5. Step 5: Move Home Directory & Restart.

Similarly, you may ask, how do I resize a partition in Linux?

Launch it using Alt + F2 , and typing gparted . When you click on resize, a window will open where you can easily drag and resize your partition.

To resize a partition:

  1. Select an unmounted partition.
  2. Choose: Partition → Resize/Move.
  3. Adjust the size of the partition.
  4. Specify the alignment of the partition.

How do I resize a partition in Windows 10?

How to resize partition in Windows 10 Disk Management:

  1. Press Windows and X on keyboard and select Disk Management from the list.
  2. Right click the partition and select Shrink Volume.
  3. In the pop-up window, enter the amount of space and then click Shrink to execute.

How to resize your ubuntu partitions

Suppose we have a virtual machine with the Ubuntu operating system installed and we want to increase the size of a partition, for example, a system partition. In this article, we will take an example of Ubuntu 20 extend partition without LVM.

Introduction

Our Ubuntu 20 is installed on Hyper-V. First, let’s check the size of the file system by running df -h (all commands are executed as root):

Our system partition, mounted in /, is 24 GB in size.

Let’s see the output fdisk -l:

In this example, we have 1 disk /dev/sda with a size of 25 gigabytes, which is divided into 3 logical ones: /dev/sda1, /dev/sda2 and /dev/sda3 with the Linux filesystem type – we are interested in it.

Increasing disk size

In a virtualization environment, we increase the size of the hard disk of our virtual machine. Most likely, your virtualization system will ask you to turn off the VM first. I increased the disk to 30 gigabytes, start the machine:

Ubuntu 20 extend partition

Attention! Before starting work on expanding the system partition, be sure to make a backup copy of your data!

After increasing the size of the disk, you need to increase the system partition itself. Let’s execute fdisk /dev/sda, where /dev/sda is the label of our disk (Disk /dev/sda):

We enter p to look at the list of partitions:

To expand a partition, you must first delete information about it. To do this, enter d and specify the partition (3 for /dev/sda3):

In this case, only the record about the partition is deleted, the data itself remains on the disk!

Enter n – creating a new partition

Next, we indicate the number of the partition:

Next, the starting and ending sectors are indicated. Be sure to check that they match the hyphenated values. This way we use all the unallocated space:

As you can see, a 29.5 gigabyte partition was created with the Linux filesystem type.

It will also ask if we want to delete the current filesystem type. We refuse:

It remains only to save the partition table:

Reboot the virtual machine:

Now we will use the resize2fs utility (for ext4) to increase the size of the filesystem:

Checking the result:

Conclusion

As you can see in Ubuntu 20 extend artition is not such a difficult task.

You can see similar articles on expanding partitions in various linux distributions:

Partitioning under Debian/Ubuntu (GUI)

To start we’ll install Gparted by running the following command:

How to resize your ubuntu partitions

How to resize your ubuntu partitions

Gparted GUI is very intuitive and easy to use. First select the device you want to work on, on the right side you’ll see a dropdown menu saying “/dev/sda (238.47 GiB)”, there you can select a different device. If you plug the device after Gparted was launched, on the top menu click deploy GParted and click on “Refresh Devices”.

How to resize your ubuntu partitions

We can not manipulate partitions of a hard disk being used so I connected an external hard drive.

How to resize your ubuntu partitions

Right click on the partition you want to resize and select Resize.

How to resize your ubuntu partitions

In my case I have not too free space, so I will only reduce the partition 2 GB.

How to resize your ubuntu partitions

Now we have 1,95 GB unused, to expand the partition instead of reducing the process is the same if we have free space, right click on the partition you want to expand, select Resize and determine the space you want to add.

How to resize your ubuntu partitions

Optionally we can format the unused space and create a new partition with a different filesystem like NTFS.

How to resize your ubuntu partitions

Right click on the unused space and select New

How to resize your ubuntu partitions

Select the size and type of filesystem, in this case also determine if you want your partition to be primary.

How to resize your ubuntu partitions

Once we finished setting our changes click on the green V icon below the main menu to write or save all changes.

How to resize your ubuntu partitions

Partitioning with fdisk

Lets run fdisk to see the options it has.

How to resize your ubuntu partitions

Lets see the partitions of the disk sdb by running

And then press p, if you need help during the process you can always press m to get help.

How to resize your ubuntu partitions

Press d to remove the existing partition

How to resize your ubuntu partitions

Press n to create a new partition and select the table.

How to resize your ubuntu partitions

Select if the partition must be primary, number of partitions, starting and end point,

How to resize your ubuntu partitions

To write changes press w.

Brief comment on cfdisk

cfdisk is a tool coming by default with Debian and Ubuntu to manage partitions with the terminal. It is a lot more friendly than fdisk. It is not useful to resize partitions keeping their content, we can remove and create new partitions assigning the size we want.

To launch cfdisk run the command and the device you want to work on.

How to resize your ubuntu partitions

cfdisk is managed with the keyboard. If you have more than one partition use down-up keys to select different partitions and keys right-left to select between the different actions.

How to resize your ubuntu partitions

Conclusion

The best way seems to be gparted with if you have X installed and internet connection. Cfdisk and Fdisk are available tools in default installations, that’s why it is important to know how to use them for an emergency without internet.

I hope you found this article useful. Keep following LinuxHint for new tips on Linux.

About the author

David Adams

David Adams is a System Admin and writer that is focused on open source technologies, security software, and computer systems.

Do you need to shrink a partition with your Linux without reinstalling the system? You can resize your partition without losing your data with GParted and this post will show you how to do that.

I used this method when I decided that I needed to re-partition my hard drive and create several new partitions to test different Linux distributions. However, I did not want to reinstall my current Arch Linux system. Instead, I shrank my Arch Linux partition and added new partitions using the free space I created. Below I share how I did that.

You can watch the video tutorial or continue reading below.

Make a GParted Live USB

The first step to shrink a partition in Linux is going to Gparted.org and download the GParted Live ISO.

Next, create a bootable USB using this ISO. You can do it from the terminal using the dd command:

The if option is the path to GParted ISO, and the option of is the USB device where you will record the ISO. You can find out the name of your USB devise with sudo fdisk -l and the size of your USB.

Boot from GParted Live

Then, boot from this live USB drive. You can keep everything default.

Just press enter for every question.

In the end, you should get to the Live session of Gparted. This is the same Gparted program you may have on your system.

Shrink an existing partition

One advantage of Live USB Gparted is that your main system is not working and you can manipulate its partitions, while Gparted in a working system cannot resize a partition.

If you have several hard drives, make sure you selected the hard drive with the partition you want to resize in the top right part of the program window. In my case, I have one hard drive and one partition.

Below, you can see the yellow area is the part with the data. It is around 3 Gb in my case. The rest is free space. Let’s use this space to create another partition.

Select this partition and click on Resize option.

You can resize it using the numbers or by mowing the arrows. I will free up 10 Gb. Enter the number, press enter, and click on Resize.

After this, the main partition is shrunk.

Create an additional partition

Now, you can create another partition. Click on the unallocated space, then click New to create a new partition.

You can select its size, whether you want it to be primary or extended. An extended partition allows you to create more than 4 partitions. You can choose the file system you need. And you can also give a name to this partition. So, when you have set everything as you want, click Add.

In the below image, you can see the two partitions I have created.

Apply the GParted changes

Everything above created only the plan of the changes to do. You can find the detail of the changes you are about to apply at the bottom of Gparted.

So, if you notice that something is wrong, it is safe to cancel at this stage.

Also, let me warn you. Although Gparted is a reliable program, there is no guaranty that your data won’t be corrupted. So, before you resize your partition, back up all the important files.

If you have backed up all important data and you are sure about these settings, press apply.

Confirm and wait a few minutes until everything is complete.

Check that there were no errors.

Now, there are two partitions on this hard drive and your system files should be intact. Close the program, double-click on exit and reboot into your main system. It should work as before.

So, the process is complete.

Other options in GParted

As you can see, shrinking a partition in Linux is simple and reliable.

Moreover, you can use this Live GParted ISO not only to shrink a partition in Linux, but to do any other manipulations including deleting partitions, increasing partition’s size, and create a brand new partition table.

Have you used Gparted? Have you ever tried this method to create new partitions? Let me know in the comments.

How do I increase partition size in Ubuntu?

To do it, right-click on the unallocated space and select New. It will walk you through creating a new partition. You can right-click on adjacent unallocated space and select Resize/Move to enlarge the partition.

How do I increase the root partition size in Linux?

7) Resizing the active root partition in Linux

Select the root partition you want to resize. In this case, we only have one partition that belongs to the root partition, so we choose to resize it. Press the Resize/Move button to resize the selected partition.

How do I change the root partition in Linux?

  1. Mount your destination drive (or partition).
  2. Run the command “gksu gedit” (or use nano or vi).
  3. Edit the file /etc/fstab. Change the UUID or device entry with the mount point / (the root partition) to your new drive. …
  4. Edit the file /boot/grub/menu. lst.

How do I resize a partition after installing Ubuntu?

  1. You installed Ubuntu on a 500 GB partition.To resize that partition,you need to boot ubuntu live disk.
  2. After booting ubuntu live disk,open gparted.
  3. Right-click on the 500 GB partition and then resize it.
  4. After resizing an unallocated space was created.

How big should my Ubuntu partition be?

Size: minimum is 8 GB. It is recommended to make it at least 15 GB. Warning: your system will be blocked if the root partition is full.

Can I resize Linux partition from Windows?

Do not touch your Windows partition with the Linux resizing tools! … Now, right click on the partition you want to change, and choose Shrink or Grow depending on what you want to do. Follow the wizard and you’ll be able to safely resize that partition.

How do I allocate more space to my root partition?

  1. Open GParted.
  2. Right click on /dev/sda11 and select Swapoff.
  3. Right click on /dev/sda11 and select Delete.
  4. Click on Apply All Operations.
  5. Open a terminal.
  6. Extend the root partition: sudo resize2fs /dev/sda10.
  7. Go back to GParted.
  8. Open the GParted menu and click on Refresh Devices.

How do I shrink a root partition?

This is the order that you will likely want to follow:

  1. Backup all your data.
  2. Boot into live environment and start GParted.
  3. Shrink the root partition to whatever size.
  4. Expand the home partition to fill in the space.
  5. Apply changes.
  6. Reboot.

How do you expand a partition?

To make any or all of that happen, follow these steps:

  1. Open the Disk Management console window. …
  2. Right-click the volume you want to extend. …
  3. Choose the command Extend Volume. …
  4. Click the Next button. …
  5. Choose the chunks of unallocated space to add to the existing drive. …
  6. Click the Next button.
  7. Click the Finish button.

How do I change partition size in Linux?

To resize a partition:

  1. Select an unmounted partition. See the section called “Selecting a Partition”.
  2. Choose: Partition → Resize/Move. The application displays the Resize/Move /path-to-partition dialog.
  3. Adjust the size of the partition. …
  4. Specify the alignment of the partition. …
  5. Click Resize/Move.

How do I move my home to a new partition?

This guide will follow these 8 basic steps:

  1. Set-up your new partition.
  2. Find the uuid (=address) of the new partition.
  3. Backup and edit your fstab to mount the new partition as /media/home (just for the time being) and reboot.
  4. Use rsync to migrate all data from /home into /media/home.
  5. Check copying worked!

How do I find the size of my root partition in Linux?

  1. How much space do I have free on my Linux drive? …
  2. You can check your disk space simply by opening a terminal window and entering the following: df. …
  3. You can display disk usage in a more human-readable format by adding the –h option: df –h. …
  4. The df command can be used to display a specific file system: df –h /dev/sda2.

Can I resize a partition without losing data?

Begin -> Right click Computer -> Manage. Locate Disk Management under Store on the left, and click to select Disk Management. Right click the partition you want to cut, and choose Shrink Volume. Tune a size on the right of Enter the amount of space to shrink.

How do I allocate more space to Linux partition?

Right click on the partition of interest and select “resize/move”. Make sure you are cognizant of where the partition has data (data is yellow and “assumed” empty is white) and avoid shrinking any partition where there is no white space left!

How do I add space to Ubuntu partition from Windows?

From within the “trial Ubuntu”, use GParted to add the additional space, that you unallocated in Windows, to your Ubuntu partition. Identify the partition, right click, hit Resize/Move, and drag the slider to take up the unallocated space. Then just hit the green checkmark to apply the operation.

As a server administrator, it is common to find our root partition is filled up with files especially logs cause our server not able to run smoothly due to not enough space. This could happened when we create only one disk partition for OS installations especially for cloud server. The workaround to solve this kind of issue either we remove the unneeded files and logs or we resize the root partition if we have more space on our physical disk.

This tutorial will focus on the solution by increasing the root disk/partition. The two important command that we are going to use is

the first step and the most important step before we start using the two commands is to backup all your data somewhere safe.
Once done, you can start check your actual physical disk size and available partition using

Then what you need to do is to run growpart against you physical disk and partition. For example your disk is /dev/vda and your partition is 1, your partition will be displayed as /dev/vda1. What growpart does is actually extending the size of your partition to the maximum allowed physical disk size. You can run below command:

Once it finish you will see growpart has extend your partition table to the maximum available disk size. Now, you need to reboot your server.
When the server comes live again, you can run resize2fs command to extend the filesystem. below is the sample command.

Since the /dev/vda1 is mounted. resize2fs will now try to extend the partition online, without having to unmount the partition first. Check your new partition size using

you should see the size of your partition and filesystem has been increase.

How do I add more disk space to Ubuntu?

To do so, right-click the unallocated space and select New. GParted will walk you through creating the partition. If a partition has adjacent unallocated space, you can right-click it and select Resize/Move to enlarge the partition into the unallocated space.

How do I add more disk space to Linux?

How to Extend Volume Group and Reduce Logical Volume

  1. To Create new partition Press n.
  2. Choose primary partition use p.
  3. Choose which number of partition to be selected to create the primary partition.
  4. Press 1 if any other disk available.
  5. Change the type using t.
  6. Type 8e to change the partition type to Linux LVM.

How do I allocate disk space from D to C?

Allocate Space from D Drive to C Drive Directly

  1. Right-click on the D partition with enough free space and select “Allocate Space” to allocate the free space to the C drive.
  2. Select the target partition that you need to extend, here, choose C drive.

How do I allocate more disk space?

To allocate the unallocated space as a usable hard drive in Windows, follow these steps:

  1. Open the Disk Management console. …
  2. Right-click the unallocated volume.
  3. Choose New Simple Volume from the shortcut menu. …
  4. Click the Next button.
  5. Set the size of the new volume by using the Simple Volume Size in MB text box.

How much space do I need to shrink Ubuntu?

Resize the Windows partition

A Windows partition should be at least 20 GB (recommended 30 GB for Vista/Windows 7), and the Ubuntu partition at least 10 Gb (recommended 20 GB).

How do I move Windows space to Ubuntu?

  1. Shrink the NTFS partition by the desired size under Windows disk management.
  2. Under gparted, move all the partitions in between the sda4 and sda7 (sda9, 10, 5, 6) as far to the left in the new unallocated space.
  3. Move sda7 as far to the left.
  4. Increase sda7 to fill the space to the right.

How do I increase disk space in dual boot Ubuntu?

From within the “trial Ubuntu”, use GParted to add the additional space, that you unallocated in Windows, to your Ubuntu partition. Identify the partition, right click, hit Resize/Move, and drag the slider to take up the unallocated space. Then just hit the green checkmark to apply the operation.

Can I resize Linux partition from Windows?

Do not touch your Windows partition with the Linux resizing tools! … Now, right click on the partition you want to change, and choose Shrink or Grow depending on what you want to do. Follow the wizard and you’ll be able to safely resize that partition.

Why is my C drive full and D drive empty?

There is not enough space in my C drive to download new programs. And I found my D drive is empty. … C drive is where the operating system installed, so generally, C drive needs to be allocated with enough space and we should not install other third-party programs in it.

What can I move from C to D drive?

Method 2. Move Programs from C Drive to D Drive with Windows Settings

  • Right-click Windows icon and select “Apps and Features”. …
  • Select the program and click “Move” to continue, then select another hard drive such as D: …
  • Open Storage settings by typing storage at the search bar and select “Storage” to open it.

How do I allocate more space to C drive without formatting?

How to Increase C Drive Space in Windows 10 Without Formatting FAQs

  1. Right-click My Computer and choose “Manage -> Storage -> Disk Management”.
  2. Right-click on the partition that you want to extend, and choose “Extend Volume” to continue.
  3. Set and add more size to your target partition and click “Next” to continue.

How do I allocate more disk space to bootcamp?

How to Allocate More Space in Bootcamp

  1. Click “Applications” on the Dock.
  2. Click “Utilities,” then “Disk Utility.”
  3. Click your hard drive in the devices on the left. …
  4. Click and drag the slider at the bottom of your “Macintosh HD” partition and drag it down to grant it more space or up to give it less space.

How can I increase disk space on my laptop?

Here’s how to free up hard drive space on your desktop or laptop, even if you’ve never done it before.

  1. Uninstall unnecessary apps and programs. …
  2. Clean your desktop. …
  3. Get rid of monster files. …
  4. Use the Disk Cleanup Tool. …
  5. Discard temporary files. …
  6. Deal with downloads. …
  7. Save to the cloud.

How do I get unallocated disk space back?

Step 1: Right-click Windows icon and select Disk Management. Step 2: Locate and right-click on unallocated space in Disk Management, select “New Simple Volume”. Step 3: Specify the partition size and click “Next” to continue. Step 4: Set a drive letter, file system – NTFS, and other settings to the new partitions.

Your Ubuntu virtual machine is running low on storage space, simply power it off and allocate more virtual hard drive space via the hypervisor settings.

Good job! Power the VM and have a look at your achievement.

How to resize your ubuntu partitions

In this scenario, the VM was initially allocated 20GB, then an additional of 10GB was added.

Now, how do you claim that precious 10GB?

1- Open GParted app.
How to resize your ubuntu partitions

Alternatively,
install via Ubuntu Software Manager or via the command line:

2- Select the current partition which you want to grow/increase.
3- Then click on the orange arrow.
How to resize your ubuntu partitions

4- Drag the slider to the right, to select all of the unallocated space.
How to resize your ubuntu partitions

5- Make sure you are happy with the numbers of bytes 😄 .
How to resize your ubuntu partitions

6- Confirm your selection.
How to resize your ubuntu partitions

7- ⚠️ Read the warning message and think twice before clicking the button.
How to resize your ubuntu partitions

8- Job done! ✔️✔️✔️
How to resize your ubuntu partitions

Tips and Tricks

Search Posts

Most Linux images on Azure will by default have 30GB size for the osDisk and that is something that you might want to resize moving forward.

NOTE: We recommend to store applications and data on a separate data disk not only because of space but also for performance reasons.

Resizing the partition is really simple on Azure and we can be done by the following procedure:

a) Stopping and deallocating the VM on the portal or Azure CLI / PowerShell;
b) Editing the disk on the portal and setting the size to the desired value;
c) Updating the partition information within the Linux OS which might be slightly different depending on the partitions and distribution but the concept is very similar , which is basically deleting and recreating the root partition.

NOTE: You must create a backup or a snapshot of the VHD prior to the resizing steps , you can use http://storageexplorer.com or also AZCopy once the VM is deallocated when using unmanaged disks. For managed disks, you can use the Azure Portal to create a snapshot of the disk.

Steps to make the required partition changes are listed below per distribution and have been tested in the specific releases listed:

For Red Hat 7.3 / CentOS 7.3 and Oracle 7.3:

1) Login to the VM using SSH, we can check the size of the disk by using: sudo dmesg | grep -i sda

We should see something similar to the output below (assuming you changed the size to 100GB on the portal for the disk): [ 3.100914] sd 2:0:0:0: [sda] 209715200 512-byte logical blocks: (107 GB/100 GiB) 2) To proceed with the partition resize, we will use: sudo fdisk /dev/sda

type: p this will show both partitions /dev/sda1 and /dev/sda2 which are basically partitions 1 and 2

type: d then 2 (to delete partition 2) type: n then p , 2 (to recreate partition 2) you can accept the default values type: w (to save the new partition) type: q (to exit fdisk) sudo reboot (to reboot the VM so the partition is updated)

3) To finalize the resize, after the reboot, execute the command:

For Red Hat 7.3 and CentOS 7.3: sudo xfs_growfs /dev/sda2

For Oracle 7.3: sudo btrfs filesystem resize max /

4) Use the command: df -h to verify its size: Filesystem Size Used Avail Use% Mounted on /dev/sda2 100G 1.6G 98G 2% /

For Ubuntu 16.04 LTS:

No extra steps are necessary, simply deallocating the VM, changing the size on the portal and starting the VM backup will work. You can verify the size after the VM is up by using:
df -h Filesystem Size Used Avail Use% Mounted on
/dev/sda1 97G 1.4G 96G 2% /

For Debian 8:

1) Login to the VM using SSH, we can check the size of the disk by using: sudo dmesg | grep -i sda

We should see something similar to the output below (assuming you changed the size to 100GB on the portal for the disk): [ 3.100914] sd 2:0:0:0: [sda] 209715200 512-byte logical blocks: (107 GB/100 GiB)

2) To proceed with the partition resize, we will use: sudo fdisk /dev/sda

type: p this will show partition /dev/sda1

type: d
type: n then p , 1 (to recreate partition 1) you can accept the default values
NOTE: if you receive a message about deleting or keeping a signature on the disk, just answer N
type: w (to save the new partition)
type: q (to exit fdisk)
sudo reboot (to reboot the VM so the partition is updated)

3) To finalize the resize, after the reboot, execute the command:
resize2fs /dev/sda1

4) Use the command: df -h to verify its size:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 99G 698M 94G 1% /

For SUSE 12 SP2 (Premium):

1) Login to the VM using SSH, we can check the size of the disk by using: sudo dmesg | grep -i sda

We should see something similar to the output below (assuming you changed the size to 100GB on the portal for the disk): [ 3.100914] sd 2:0:0:0: [sda] 209715200 512-byte logical blocks: (107 GB/100 GiB)

2) To proceed with the partition resize, we will use: sudo fdisk /dev/sda

type: p this will show both partitions /dev/sda1 and /dev/sda2 which are basically partitions 1 and 2

type: d then 2 (to delete partition 2) type: n then p , 2 (to recreate partition 2) you can accept the default values type: w (to save the new partition) type: q (to exit fdisk) sudo reboot (to reboot the VM so the partition is updated)

3) To finalize the resize, after the reboot, execute the command: resize2fs /dev/sda2

4) Use the command: df -h to verify its size: Filesystem Size Used Avail Use% Mounted on /dev/sda2 98G 1.2G 92G 2% /

For CoreOS (Stable):

No extra steps are necessary, simply deallocating the VM, changing the size on the portal and starting the VM backup will work. CoreOS has a few extra partitions and the extra space will be added to the root partition (usually /dev/sda9).