- How do I resize root partition?
- 6 Answers 6
- How to Resize Ubuntu Root Partition
- How to expand Ubuntu root filesystem
- Ubuntu Root Resize in Review
- Follow me
- 4’000 Stars and counting, a trip down memory lane
- 2022 Retrospective 2022 and Goals/Predictions for 2023
- Apple Freeform vs Miro
- Tutorial resize root partition on Linux Ubuntu and Debian
- How to resize root partition on Linux Ubuntu and Debian
- What is a root partition?
- Resize root partition on Linux Ubuntu and Debian
- Conclusion
How do I resize root partition?
I have a dual boot setup with Ubuntu and Windows 7. I need to shrink my root Ubuntu volume in order to get some free space to create a new partition. Are there any Windows based tools that will do this for me? I tried booting up in gparted to do this but I cannot tell which partition is which since I cannot find the size (it displays everything in blocks).
Windows 7 comes with it’s own resizing Tool but can only resize NTFS volumes as Windows 7 doesn’t «see» ext4 (or other Filesystems besides FAT) by the way you shouldn’t resize stuff while you’re using the drive, what you see on gParted are partitions the most obvious way to tell which one is the one you want to change is simply by looking at its size.
I can’t see size, only blocks. are there any softwares on windows that support the resizing of ext3 drives?
@Necross gparted is a graphical tool, not command line, and it clearly shows size in mb, and what the filesystem type is so you can easily tell which one is the Windows partition ( because it is NTFS ).
6 Answers 6
Parted Magic is a good suggestion, but if you already have an Ubuntu live CD or USB stick you can boot from that and run GParted from there. Basically, you need to boot from something which is not the hard drive you’re going to resize partitions on.
As it’s already been pointed out — gparted is a graphical utility, so what you’re referring to as «GParted» is definitely not it. Which brings me to another important point: make sure you have a backup of everything, because your chances of screwing everything up are relatively high 🙂
You can burn the Parted Magic OS into a CD and boot from that. That OS includes a very basic graphical interface as well as GParted and other graphical tools. It should make a job like resizing any partition really easy, because it boots from ram and you can manipulate any partition from the familiar environment of GParted.
- Website
- Screenshots: You can note from the screenshots that size on that GParted is displayed quite nicely.
Resizing a partition is a slow task, so make sure your computer doesn’t shut down if you are on a laptop for example.
- Boot with Ubuntu installation cd, choose to try ubuntu
- Use GParted partition editor to resize your partitions.
Yes, use gparted. Boot from your Ubuntu CD and in the terminal type: sudo -i gparted
there you can resize and delete/create partitions. When you apply the changes, I would recommend not to interrupt the progress.
How to Resize Ubuntu Root Partition
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
root@Docker01:~# pvdisplay --- Physical volume --- PV Name /dev/sda1 VG Name ubuvg PV Size 16.00 GiB / not usable 2.00 MiB Allocatable yes PE Size 4.00 MiB Total PE 4095 Free PE 678 Allocated PE 3417 PV UUID HiNAY2-sfqz-7fwT-tLvy-XKfT-3QR6-BXash5
root@Docker01:~# fdisk /dev/sdb n (create new partition, select start and end cylinders, all free space is selected by default) Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): Using default response p Partition number (1-4, default 2): Using default value 2 First sector (33552384-33554431, default 33552384): Using default value 33552384 Last sector, +sectors or +size (33552384-33554431, default 33554431): Using default value 33554431 w (save partition table and exit)
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.
root@Docker01:~# reboot - Step 4 Update the partition table tool using cfdisk.
root@Docker01:~# 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 - Step 5 Intialize the newly created partition with pvcreate
root@Docker01:~# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created
- 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
"/dev/sda3" is a new physical volume of "9.00 GiB" --- NEW Physical volume --- PV Name /dev/sda3 VG Name PV Size 9.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID OEADew-tamR-EHil-FU4p-kIuW-F5rT-V0CTcY
Run the command vgs in order to get the name of your volume group
root@Docker01:~# vgs VG #PV #LV #SN Attr VSize VFree ubuvg 1 5 0 wz--n- 16.00g 2.65g
Expand the volume group with vgextend then verify your volume group again once complete with vgs
root@Docker01:~# vgextend ubuvg /dev/sda3 Volume group "ubuvg" successfully extended root@Docker01:~# vgs VG #PV #LV #SN Attr VSize VFree ubuvg 2 5 0 wz--n- 24.99g 11.64g root@Docker01:~#
root@Docker01:~# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/ubuvg-ubulv 8726456 7739868 520260 94% / root@Docker01:~# lvextend -L +10G /dev/mapper/ubuvg-ubulv Extending logical volume ubulv to 18.58 GiB Logical volume ubulv successfully resized
root@Docker01:~# resize2fs /dev/mapper/ubuvg-ubulv resize2fs 1.42.9 (4-Feb-2014) Filesystem at /dev/mapper/ubuvg-ubulv is mounted on /; on-line resizing required old_desc_blocks = 1, new_desc_blocks = 2 The filesystem on /dev/mapper/ubuvg-ubulv is now 4871168 blocks long. root@Docker01:~# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/ubuvg-ubulv 19048316 7744220 10420152 43% /
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!
4’000 Stars and counting, a trip down memory lane
A trip down memory lane & the history of Docker, Compose and monitoring w/ Docker & Prometheus. Along the way, I discovered an amazing community.
2022 Retrospective 2022 and Goals/Predictions for 2023
There is no beating around the bush about 2022; it was damn hard! 2022 challenged me professionally, physically, and organizationally. But, at the same time, we had some great highlights to celebrate the small wins. 2022 will go down in history as unique that we finally came out of the
Apple Freeform vs Miro
A review of the collaboration canvas tools Apple Freeform and Miro. Both tools allow for brainstorming with virtual post-it notes with others to structure ideas visually. This article compares Apple Freeform with Miro.
Tutorial resize root partition on Linux Ubuntu and Debian
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.
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:
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.
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.
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:
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:
lvextend -L +10G /dev/mapper/ubuvg-ubulv
Finally, expand the Filesystem with the following commands to fill the logical volume:
resize2fs /dev/mapper/ubuvg-ubul
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.
Click on a star to rate it!
Average rating 3 / 5. Vote count: 2
No votes so far! Be the first to rate this post.