0

I have struggled with my problem for days, and have tried to find different kind of solutions, but now I decided to ask.

My primary problem is too small sda1 partition which is 243M and 100% full. Sda2 which includes sda5 is the rest 148.8G

Gparted booted from USB shows that sda5 is full, thus won't let to decrease it's size.

However the sda5 uses really only about 21G, showing 14% when using #df -h

I have extra drive (80G) where I installed another Ubuntu, and I have mounted the old sda5 to get files from there.

Now my secondary problem is, that I can't find out how to resize the original sda5 from terminal. I think it can be done because it really isn't full (as gparted thinks it is), and it doesn't have to be mounted because it's secondary drive when the machine is booted from extra drive.

I can't get some info (like df -h) from the original drive, because the machine is and has to be booted from secondary right now, but I will do my best to get as much extra info as possible.

Thank you in advance!

Additional info: The primary disk I'm trying to get to work is Ubuntu Server 12.04 The secondary disk is using Ubuntu 14.04

Primary disk's sda5 is LVM

3
  • GParted is showing it as full because LVM uses the whole disk. The logical volumes in LVM aren't visible to GParted. You might have to use some other program. Try the Disks utility. It will show the LVM logical volume separately.
    – muru
    Sep 9, 2014 at 23:17
  • @muru "Disks utility" as in "gnome-disks" for >12.10? I tried to find instructions for that, and it was the only thing close for it. Thank you, I will try it.
    – MikeJK
    Sep 9, 2014 at 23:40
  • Yes, gnome-disks.
    – muru
    Sep 9, 2014 at 23:41

1 Answer 1

0

To reduce the size of an existing LVM logical volume:

Shrinking a logical volume is likely to destroy any filesystem located on that volume.

If you want to preserve existing files then you will need to:

Reduce the size of the underlying block device (the logical volume) to match that of the filesystem.

Suppose that /dev/vg0/sda5 is a logical volume of size 148GB. You wish to reduce its size by 48,8GB to 100GB.

A logical volume can be shrunk using the lvreduce command. You can specify either the amount by which you want to reduce the size of the volume or the final size that you want to achieve:

sudo su
lvreduce --size -48,8G /dev/vg0/sda5
or
lvreduce --size 100G /dev/vg0/sda5

Note: If the logical volume contains a filesystem that you wish to preserve then you must not make the volume smaller than the filesystem.

Verify the size of the logical volume using the lvdisplay command:

sudo su
lvdisplay /dev/vg0/sda5

Source: https://wiki.debian.org/LVM

3
  • I think that will be the solution, when I find the correct path. No luck so far though. #sudo lvscan gave me "ACTIVE '/dev/username-vg/root' [144,81 GiB] inherit", I deactivated it, and now it gives "inactive '/dev/username-vg/root' [144,81 GiB] inherit" but still no luck with tabbing after "sudo lvreduce --size 100G" and trying /dev, /username and so on. with /dev/sda5 it gives "Path required for Logical Volume "sda5" "
    – MikeJK
    Sep 10, 2014 at 0:44
  • I have tried to find out what is the exact path to the sda5, but no luck. Also I have tried to find out about the filesystem size, but if I understood correctly, it's the used 21G, right?
    – MikeJK
    Sep 10, 2014 at 13:46
  • I have found the path. I managed to reduce the size, but the disk went corrupted. I increased the size back and it works as earlier now. I have to reduce the filesystem size also, but haven't found out how exactly yet.
    – MikeJK
    Sep 14, 2014 at 21:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .