22

I have 2 hard drives that had been used for Ubuntu Server 11.10. Now I would like to start from scratch with 12.04 but I'm having some trouble with the existing logical volumes and volume groups. Erasing data during install looks like it's going to take days. Is there a quick and simple way to wipe out all volumes/groups/partitions so I can start with 2 empty drives? When I set this up on 11.04 it took me a while to learn how to do it and I've since forgotten most of what I learned.

For what it's worth, I'm only using this box to learn about Linux.

5 Answers 5

34

Just for the sake of this question, I just encountered the same problem and here's how I fixed it (all these commands were entered from a live session) :

sudo vgdisplay

then I located the group name to delete

sudo vgremove <groupname>

said yes to all questions.

Then, I could manually format the whole device thing with GParted.

4
  • I had the same problem when installing Ubuntu 14.04.3 and totally replacing an old CentOS install and this solution worked well for me. Nov 18, 2015 at 5:39
  • Did the trick for me, after that I was able to format the disk with gparted from the live cd.
    – wawa
    Dec 2, 2015 at 15:43
  • Did not work vgremove says try calling vgreduce --removemissing but that also fails. Feb 12, 2016 at 5:00
  • Just ran into the same issue and this answer solves the problem. Just for the record, I used "sudo vgscan" which gives a terse output (than "sudo vgdisplay") Apr 19, 2016 at 21:40
9

I was unable to delete a partition because it was in use by a Volume Group (system). I was told it was unable to delete that Volume Group because a Physical Volume was missing.

Once I ran vgreduce --removemissing system I was able to delete the Volume Group and then the partition leaving me right where I wanted to be.

Thanks for the suggested answers, they got me thinking on the right track.

3
  • 2
    Just to add to that, press ALT-F2 whilst using the Ubuntu installer to bring up a console, where you can enter vgreduce --removemissing system as suggested.
    – NickG
    Jun 22, 2013 at 13:28
  • 3
    I used vgremove <LVM Group Name>
    – Erik
    Oct 5, 2014 at 0:39
  • +1, I was able to make this work -- changing system for the volume group name, this put me in a good enough state that vgremove started working. Woot! Feb 12, 2016 at 5:02
4

All you need to do is choose the "use whole disk" option in the installer. It will wipe out whatever is on the drive.

5
  • 1
    Will that limit what I can do with the drive(s) after install?
    – Mark
    Dec 12, 2012 at 3:19
  • 1
    Gave it a shot. Here's what I got- Unable to automatically remove LVM data. Because the volume group(s) on the selected device also consist of physical volumes on other devices, it's not safe to remove automatically. Please remove it's LVM data first.
    – Mark
    Dec 12, 2012 at 3:28
  • @Mark, that's weird... choose manual partitioning and delete the existing partitions then.
    – psusi
    Dec 12, 2012 at 15:42
  • 1
    It tells me the partition is in use by LVM volume group. When I try to delete the volume group it tells me it can't because 1 or more logical volumes may be in use. It's showing me 0 Free Physical Volumes, 2 Used PVs, 1 VG and 0 Logical Volumes. I do see that the VG consists of 2 PVs - /dev/sda2 and unknown. Virtual Console(4) tells me it can't change Virtual Group while PVs are missing. I hope that makes some sense to you. I'm confused.
    – Mark
    Dec 12, 2012 at 20:05
  • Ha! I got it. Had to use vgreduce --removemissing system. Now I have two clean, empty drives. I should probably read up on LVM before going ahead with installation. Heck, it's a "learning" server. Thanks for the help!
    – Mark
    Dec 12, 2012 at 20:15
1

Booting from a LiveCD, starting GParted and creating a new partition table on each drive will effectively remove all existing partitions. The amount of data written will be negligible, so it should not take long.

All data on the drives will be lost.

4
  • After d/l LiveCD and trying to create partition table with GParted, it tells me 1 partition is currently active and a partition table can't be created. I have no option to unmount.
    – Mark
    Dec 12, 2012 at 3:18
  • @Mark: This would be a swap partition on the HDD to which LiveCD swaps by default. Right-click on the partition and choose "swap off"
    – Sergey
    Dec 12, 2012 at 3:22
  • Huh, no "swap off" just - New, Delete, Resize/Move, Copy, Paste, Format to, Unmount, Manage Flags, Check, Label, New UUID, information. Only Manage Flags and Information are not grayed out.
    – Mark
    Dec 12, 2012 at 3:37
  • Would it cause trouble in the future if I just unplugged the drive, installed on the second and handled the partitions after install? With the exception of setting up the sever a year ago I'm unfamiliar with LVM.
    – Mark
    Dec 12, 2012 at 3:43
1

I experienced a similar situation.
I found that I had to go through the installation process to the part where you select the mode of creating the partitions: Guided or Manual.
Then I could use the Alt+F2 to switch to another console. When I typed help, it did not show any of the LVM commands. I used vgdisplay to see the name of VirtualGroup.
I then specified vgreduce -v -f <inserted my VirtualGroup name from the vgdisplay> - where the v flag specifies verbose so I could see what LVM was doing, and the f flag to force, since the first few times it complained about not finding the missing drive.
Then I switched back to the main console Alt+F1 and selected Guided using LVM. The installer found the fixed LVM partition and deleted it, so that I could continue with the install.

You must log in to answer this question.

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