Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi glen,
Here's the list of steps for a simple scenario where you have two partitions, /dev/sda1 is an ext4 partition the OS is booted from and /dev/sdb2 is swap. For this exercise we want to remove the swap partition an extend /dev/sda1 to the whole disk.
As always, make sure you have a backup of your data - since we're going to modify the partition table there's a chance to lose all your data if you make a typo, for example.
Run sudo fdisk /dev/sda
use p to list the partitions. Make note of the start cylinder of /dev/sda1
use d to delete first the swap partition (2) and then the /dev/sda1 partition. This is very scary but is actually harmless as the data is not written to the disk until you write the changes to the disk.
use n to create a new primary partition. Make sure its start cylinder is exactly the same as the old /dev/sda1 used to have. For the end cylinder agree with the default choice, which is to make the partition to span the whole disk.
use a to toggle the bootable flag on the new /dev/sda1
review your changes, make a deep breath and use w to write the new partition table to disk. You'll get a message telling that the kernel couldn't re-read the partition table because the device is busy, but that's ok.
Reboot with sudo reboot. When the system boots, you'll have a smaller filesystem living inside a larger partition.
The next magic command is resize2fs. Run sudo resize2fs /dev/sda1 - this form will default to making the filesystem to take all available space on the partition.
That's it, we've just resized a partition on which Ubuntu is installed, without booting from an external drive.
Can anyone give me instruction on how to do this in the command line please. Ubuntu is using the default lvm with 3 partitions
Not without hard data on your current setup. Disk(s), Partition(s), pvs, vgs, lvs, fstab, ...
Get the picture ?. We're running blind, and you ain't helping.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.