3

I've got a MacBook Pro (late 2011). I just bought a 1TB HDD to replace the original 500GB. My plan was to partition the 1TB in half and let one side be Ubuntu and the other OS X (until I can reasonable get rid of OS X. I need it for work).

Right now I have Ubuntu 12.10 installed on the 1TB and it's fine, but it's taking up all of the drive. It automatically set the partition that way. I made sure to check the LVM box. Easy to resize, they said. Right. Here's what I've got right now, as seen from booting up on a live CD or USB:

enter image description here

The partition is locked. It's not mounted though. Yet for the life of me I can't figure out how to resize it. It makes me wonder why I bothered with the LVM in the first place instead of just installing on FAT32. In fact the real reason it's this way is that I just let it do the auto install, and was never given an option for other partition setups. I did this because I wanted to make sure the EFI partition was set up right. I've had problems with that on past computers.

I have a few questions, but only a few need to be answered to solve this for me. I'm less concerned with the intellectual pursuit at this point than I am in just getting it working.

Why can't I resize this? Why is it locked? More importantly, how do I fix this? Google returns answers that don't work for one reason or another.

Should I go back and reinstall but do it all manually and set it up as 2 partitions? If so, do I need to create a EFI and swap partition in the process, or is EFI taken care of automatically?

I'm coming back to linux after years away, so I'm quite rusty. Any help will be greatly appreciated.

edit: the following is from the terminal

ubuntu@ubuntu:~$ sudo e2fsck -f /dev/sda3
e2fsck 1.42.5 (29-Jul-2012)
/dev/sda3 is in use.
e2fsck: Cannot continue, aborting.

ubuntu@ubuntu:~$ umount /dev/sda3
umount: /dev/sda3 is not mounted (according to mtab)

So it's in use but yet it's not mounted?

Eric Carvalho
  • 54,385
Yhilan
  • 33
  • Remember that umount needs to be run as root. Also, please attach the output of mount and sudo fuser /dev/sda3. – Andrea Corbellini Dec 11 '12 at 13:20
  • fuser doesn't return anything. mount returns a lot, but a lot says 'none'. what should I be looking for? – Yhilan Dec 11 '12 at 15:13
  • I agree with kprkr, following the ubuntu install gui default installation steps really create a very surprising output while the note for the LVM option says easily to modify/resize the partition. Im also encountering similar problem. The note should actually say easily to 'expand' not 'resize' as you cant shrink the partition at all once the default installation is done. –  Oct 29 '13 at 14:37

2 Answers2

1

If you have lvm, you need to use lvm tools to manage the Logical Volumes and Volume Groups. Your /dev/sda3 is not mounted but is probably defined as a Physical Volume in your VG. This is why it is in use.

Try using sudo pvs command to see your physical volumes, sudo vgs for volume groups and lvs for logical volumes. (pvdisplay, vgdisplay and lvdisplay also give other details about the volumes).

From the LV list, you need to select the LV you want to resize and resize it using the LV name not the /dev/sda3 physical partition.

Obs: as this is probably the LV with the / filesystem, you will need to resize it booting from a live cd (it's the same as without lvm, you can't unmount the volumes in use).

OBS: from your screenshot, you are using gparted and gparted is not able to work with LVM partitions at least until 12.04 (edit: but on your screenshot of 12.10 it appears to be working...). You need to use fdisk (seems that parted works too but I never used it...)

laurent
  • 6,779
  • I'm booted off a USB version of the live cd. I'm working with the commands you've mentioned and have managed to resize the volume but the filesystem isn't wanting to resize. This is the error: The filesystem size (according to the superblock) is 243041280 blocks The physical size of the device is 111969280 blocks Either the superblock or the partition table is likely to be corrupt! Abort? yes – Yhilan Dec 11 '12 at 15:17
  • You need to resize the filesystem first of course and the volume after. This is not due to lvm... :). Try resizing the volume to its original size and resize the fs. After that you resize the volume (to something exactly iqual or little bigger than the fs). Obs: the volume is the container of the filesystem... if you shrink it 1st, you have an insconsistent fs like if you physically removed a part of the disk... – laurent Dec 11 '12 at 15:29
  • Once you resized the LV, you can let the space left on the VG to make other LVs. I don't think it is a good idea to try to resize the /dev/sda3 (lot of steps including removing it from the lvm and reattaching) to build another physical partition in the space opened. Anyways, I think it would defeat the lvm purpose. – laurent Dec 11 '12 at 15:39
  • excellent. thanks so much for the help. sorry for being a n00b. i've had literally 4 hours with ubuntu up to now. – Yhilan Dec 11 '12 at 15:52
  • no problem! agility will come with use! lvm is very flexible once you use it the proper way. – laurent Dec 11 '12 at 15:54
0

You don't mount a physical LVM volume. Ever. Running fsck (meant to scan Extended Filesystem) on an LVM PV? Installing Linux on FAT32?

I don't think it's as much about the intellectual pursuit as about the need to understand the basics instead of trying things willy-nilly. In order for this not to be a rant about yet another user unwilling to learn and expecting things to magically work:

  1. Shrink your filesystems on Logical Volumes (if the FS supports it)
  2. Shrink your logical volumes with lvresize
  3. Resize the underlying physical volume.
  4. Resize the partition used as the physical volume.

To summarize - not worth it unless you know what you're doing and know how LVM bits and pieces fit together. Plan your installation more carefully in the future.

  • Your feedback is appreciated, however it may be worth noting that it only is the way it is because it was the most straightforward "click here to install ubuntu" option in the installer and I was trying to avoid getting into something I wasn't too sure about, namely the EFI partition and issues w/ incompatible file systems. – Yhilan Dec 11 '12 at 14:43
  • @kprkr, the regular (GUI) Ubuntu installer does not even support LVM let alone set it up by default. You really have to go out of your way to use it. – psusi Dec 11 '12 at 16:52