How to unlock partition in Gparted?

170,694

Solution 1

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.

Solution 2

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.

Solution 3

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

Share:
170,694

Related videos on Youtube

Shelly
Author by

Shelly

Updated on September 18, 2022

Comments

  • Shelly
    Shelly over 1 year

    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

    • Mitch
      Mitch about 11 years
      What is you total drive capacity?
    • Shelly
      Shelly about 11 years
      160 GB. Thanks for the reply and edits. : )
  • Shelly
    Shelly about 11 years
    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
    Shelly about 11 years
    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?
  • FSMaxB
    FSMaxB about 11 years
    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
    FSMaxB about 11 years
    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.
  • Shelly
    Shelly about 11 years
    Thanks for the suggestions. I will try this out and let you know.
  • Shelly
    Shelly about 11 years
    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
  • FSMaxB
    FSMaxB about 11 years
    Then maybe another one can solve your problem. I have no further suggestions on what to do.
  • David Foerster
    David Foerster over 10 years
    This won't work, because /dev/sda5 contains a LVM container. Please have a look at my answer.
  • FSMaxB
    FSMaxB over 10 years
    @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!
  • David Foerster
    David Foerster over 6 years
    How does that help with LVM volumes? -1