41

I can't format my hard disk for Ubuntu installation. It has Fedora installed in it. I wonder how to unlock the locked partition to delete and format it, since I am stuck at installing Ubuntu. I am now using a live CD to do the task. No options are available for me to use.

Screenshot:

Screenshot of GParted

3
  • have you considered deleting the partition from Fedora ? Nov 15, 2012 at 13:03
  • 1
    I am trying to delete it, but it is locked.
    – owl
    Nov 15, 2012 at 13:29
  • 2
    Force unmount the partition. Look into my answer below. Nov 15, 2012 at 13:34

5 Answers 5

44

If it's an LVM partition, you will need to deactivate it using the command lvremove which will remove the lock.
Only then can you delete the partition using gparted.

Use lvscan to view the volume.

Use lvremove to remove it.

Check man pages man lvscan and man lvremove for details.

5
  • 4
    This was the solution for me! Apr 11, 2013 at 2:45
  • 3
    This is a very useful answer. Using these commands only deactivate lvm2 partitions which then means it is possible to delete the lvm2 partitions through gparted. Fancy having a go at updating your answer to provide a fully working and brilliant answer?
    – geezanansa
    Aug 24, 2013 at 10:36
  • Didn't know about lvscan and lvremove. Worked great. Thank you!
    – wulftone
    Aug 24, 2013 at 23:04
  • This should be the answer
    – kbuilds
    Dec 17, 2013 at 0:45
  • 2
    if you're using gparted, it will show Deactive when you right-click on the LVM partition May 16, 2016 at 15:36
11

Right click on the swap partitions and select swapoff. This will unlock the extended partition and let you resize/move.

0
6

Open a Terminal on Ubuntu (live cd) and force unmount the partition.

sudo umount -f <name of your partition>

The name of your partition is probably something like /dev/sdb or /dev/sda2. Be careful to type the right file name here. You can use df to find the device file for a mounted partition.

2
  • unmount doesn't exist, you want umount. Apr 11, 2013 at 2:45
  • 1
    Using 13.04 liveDVD and gparted view->file system support shows lvm(2) is not supported. Using sudo umount /dev/sdaX confirms LVM partition is not mounted to beigin with. This answer is not useful.
    – geezanansa
    Aug 24, 2013 at 10:18
4

My 'active distro' occupied another drive, I just wanted to get rid of the Fedora LVM - fedora doesn't play nice with other distro's destroyed my 'grub2' list and wouldn't allow any other distro to boot, so needed to 'get rid'

lvscan + lvremove as sudo worked a treat

$ sudo lvscan
  ACTIVE            '/dev/fedora_localhost/swap' [7.81 GiB] inherit
  ACTIVE            '/dev/fedora_localhost/home' [407.39 GiB] inherit
  ACTIVE            '/dev/fedora_localhost/root' [50.00 GiB] inherit
$ sudo lvremove /dev/fedora_localhost/swap
Do you really want to remove and DISCARD active logical volume swap? [y/n]: y
Logical volume "swap" successfully removed
$ sudo lvremove /dev/fedora_localhost/home
Do you really want to remove and DISCARD active logical volume home? [y/n]: y
Logical volume "home" successfully removed
$ sudo lvremove /dev/fedora_localhost/root
Do you really want to remove and DISCARD active logical volume root? [y/n]: y
Logical volume "root" successfully removed

Issue resolved ... thanks 'geezanansa'

1
  • It does not work in my case, i got the same msg every time: Failed to write metadata to /dev/sdc2 fd -1 and WARNING: Failed to write an MDA of VG fedora. and Failed to write VG fedora. Then the partition become INACTIVE. Mar 12, 2019 at 13:36
1

Open the Ubuntu Installer and click "Install Ubuntu", then continue untill you see "Erase disk and install Ubuntu". It will erase the entire disk and use all of it for installation. Ubuntu will automatically partition your disk and proceed with installation. For more information about installing Ubuntu, you can visit this page. You don't need to format the hard disk before you install Ubuntu, the installer does it automaticaly.

1
  • Great. You now only have one option if there were lvm partitions: a one-size fits all partition scheme. Oh, this will work, but is just bad. May 12, 2021 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.