Assuming the common case of an ext2/3/4 filesystem, the answer would be resize2fs
, part of the e2fsprogs
package. It can even run on mounted partitions.
Usage:
resize2fs /dev/sda3
where /dev/sda3
is the partition you want to resize. This automatically expands the filesystem to occupy the whole partition.
Update
In your case, with LVM, there are additional steps necessary:
- Resize the Physical Volume with
pvresize /dev/sda2
- Look at either
mount
, /etc/fstab
or vgdisplay
or lvdisplay
to get your root filesystems volume name. It should be something like /dev/MyVolumeGroup/MyRootVolume
.
- Add the free space to your volume with the following command:
lvextend -l +100%FREE /dev/MyVolumeGroup/MyRootVolume
.
- Then, resize the filesystem:
resize2fs /dev/MyVolumeGroup/MyRootVolume
After this procedure, you should be able to utilize the newly added space.
Before performing this task, it's highly recommended that you backup your data.
You cannot resize the partition under the Operating System working/running from the same partition.
In your case, if the /dev/sda7
is your /
file system from which you work and try to resize it, then you need to boot your machine from different place. You can make live CD, boot the machine from DVD or USB and run gparted
from there.
You can boot from Ubuntu's LiveCD and use GParted on it or download GParted's LiveCD .iso, burn it to a CD and boot into it.
Unmount (if it's mounted) the partition that will be involved in the resize/move operation, /dev/sdaX (by right clicking and selecting unmount from the context menu),
Since the unallocated space is to the left of the ext4 partition you wish to resize, you'll first need to move the partition to the left of the unallocated space, which might cause boot error. Follow GParted's instructions on moving partitions.
As Gparted moves partitions, not unallocated space, it is may be quite complicated task to get your aim. This is because you have a number of partitions. So you probably need to move them all to the left. At the final step your partition /dev/sda7
will be moved and resized (increased).
Moving partitions is a copying itself, so it is going to take many hours. So probably it would be easier to save all critical data as backup to external drive, and then delete all partitions, design a new partitioning, reinstall OS and restore your data from backup.
Best Answer
You can, but it's not a great idea.
In GRUB, what you would do is specify different kernel and
initrd
files for each distribution installed on the system.However, the boot configuration for one distro may conflict with the configuration for the other distro(s), depending on how each distro sets its boot configuration and names its files in
/boot
. This could lead to a messed-up configuration and potentially leave one or more distros unbootable. Special care should be taken when updating the kernel or changing boot settings in any of the distros. If there are no conflicts, however, you should be able to boot both operating systems without issues.