16

Im new in using Ubuntu and I cant seem to make any partitions for a new dual boot OS and the swap file or for any other matter i would want to use the partition because the drive is locked.

I have already tried running the Live CD or in my case a Live USB and then ran Gparted but the status is still the same. Could anyone please shed some light in this matter?

enter image description here enter image description here

Shelly
  • 161
  • What is you total drive capacity? – Mitch Apr 03 '13 at 10:03
  • 160 GB. Thanks for the reply and edits. : ) – Shelly Apr 03 '13 at 10:04
  • If size is fixed (in systemrescuecd you have no memory to increase or reduce size) try to copy current sda and paste it to create new sda in free memory. Then delete previosly sda (ext4 with directory 'y') and after reboot set grub like here said http://webhamster.ru/site/page/index/articles/comp/196 – Artem.Borysov Nov 22 '15 at 18:39

3 Answers3

9

If partitions are showed with a lock in gparted, then they are mounted. Usually GPartEd is able to unmount them, but sometimes this isn't possible, so you have to manually unmount them with the following commands as root:

  • umount /dev/sda1
  • umount /dev/sda5

If you aren't logged in as root (root normally has '#' at the end of the command prompt whereas a normal user usually has '$'). You need to add sudo in front of the commands.

In case of the screenshots however, at least /dev/sda1 is mounted in a way it can't be unmounted as it is necessary for the currently running system to work.

One way you can avoid the drives being mounted ("locked") in the first place, is using a liveCD like PartedMagic (http://www.partedmagic.com). This one really shouldn't mount any of your partitions if you don't manually say so.

FSMaxB
  • 569
  • Hello @FSMaxB, i would give you a +1 but my current reputation wont allow me to. I will give this a try. I am concerned however if I unmount this while running Ubuntu (ie. unmount dev sda5 using currently running Ubuntu and not the LiveCD), will give back any errors or is that even possible? – Shelly Apr 03 '13 at 10:26
  • I did try the sudo umount /dev/sda5 and it returned umount: /dev/sda5: not mounted but when checking in gparted it is still locked. Any insights on what I am doing wrong? – Shelly Apr 03 '13 at 10:36
  • 1
    You can't unmount the partition where ubuntu is running on. If you want to change anything to partition where the system is installed, there is no other way than using a liveCD. As to /dev/sda5: This seems to be something with lvm (logical volume manager), but I don't really know what lvm is. This should, however, not be mounted when using a liveCD. – FSMaxB Apr 03 '13 at 11:11
  • I already ran the LiveCD and checked it again with gparted and it is still mounted. Or are you telling me that i should run the Terminal command thru LiveCD and check again via gparted? – Shelly Apr 03 '13 at 11:17
  • Which liveCD did you run. Parted Magic? And yes, try the commands from the LiveCD as well. If this doesn't work, I can't help you, but you could add the "lvm" tag to your question, so you have a greater chance that someone knowing something about lvm reads your question. – FSMaxB Apr 03 '13 at 11:23
  • Thanks for the suggestions. I will try this out and let you know. – Shelly Apr 03 '13 at 11:40
  • The LiveCD and PartedMagic both dont seem to work. Parted magic allows me to deactivate the drive but will not let it partition it. I have tried the umount command usin terminal thru partedmagic and ubuntu livecd as well – Shelly Apr 05 '13 at 10:56
  • Then maybe another one can solve your problem. I have no further suggestions on what to do. – FSMaxB Apr 05 '13 at 11:14
  • This won't work, because /dev/sda5 contains a LVM container. Please have a look at my answer. – David Foerster Sep 26 '13 at 10:34
  • @DavidFoerster You have to keep in mind that this question was asked more than five months ago, so probably it isn't relevan't to the person asking anymore, so don't think it's going to get accepted. However this is still relevant to others having the same problem! – FSMaxB Sep 27 '13 at 09:34
8

GParted doesn't support managing partitions inside LVM volumes. You will have to do this by hand:

  1. Boot the live system.
  2. Mount the LVM volume.
  3. Resize the contained file system.
  4. Unmount the volume.
  5. Resize the volume.
  6. Resize the volume container.
  7. Resize the volume container partition.
  8. Reboot.

These are the general steps to take. The specifics depend on the file system and I don't know the LVM commands by heart. Please consult the relevant manual pages and open another question specific to this topic, if you run into problems.

Edit: This is the reason LVM isn't part of the default Ubuntu setup.

David Foerster
  • 36,264
  • 56
  • 94
  • 147
2

Disks (gnome-disks) which uses Udisk is a very simple and capable utility. It allowed me to have 2 bootable Linux partitions and to mount a previous broken file system. That way I could extract all my data and settings.

Although Udisk doesn't replace Gparted, it has some useful features. Setting partition labels, mount points and automount is simple in the rather too basic graphic interface.

It also allowed me to unmount partitions which Gparted wouldn't. (The main reason for this answer)

Couple of pics to illustrate my setup. sdb1 & sbd6 are bootable from grub, and sdb7 is the damaged partition.

www.hdtta.co.uk/ios7/gparted.png

www.hdtta.co.uk/ios7/udisk.png

lincolo
  • 29