Skip to contentSkip to conversation

lvremove is not deleting the file system

linux-lvm Guy Rouillier 3 participants 7 messages Dec 30, 2013

lore
Share & tools
lore
#0 lore raw

I'm using xen-create-image in an attempt to set up a new VM; host OS is Ubuntu Server 13.10, and I'm using LVM. I failed in my first attempt due to my inexperience, so I changed some input parameters and I'm trying again. The first attempt had successfully created the target LVM volumes for boot, root and swap, so I used lvremove to delete them. All that went without error.

However, now when I try to run xen-create-image, I get the following error at the beginning when xen-create-image tries to create the target volumes:

Creating btrfs filesystem on /dev/dell-vg/oraclelinux-root /dev/dell-vg/oraclelinux-root appears to contain an existing filesystem (btrfs).
Error: Use the -f option to force overwrite.
Running command 'mkfs.btrfs /dev/dell-vg/oraclelinux-root 2>&1' failed with exit code 256. Aborting

I've tried searching for this error but can't find anything helpful. I've rerun this a dozen times and get the same result each time (deleting the created volumes and rebooting between each attempt.) I looked in the /dev tree, and I see the dm node (dm-4) disappears after I run lvremove. But apparently, lvremove doesn't delete the filesystem. So when I recreate the same volume in the same order, the filesystem is still there from the previous attempt.

How do I fix this? Thanks.

Signature · 5 lines
Guy Rouillier

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
#1 lore raw

Hi Guy,

This is not really a LVM problem I think. Basically lvremove only removes a logical volume, which means, the metadata is discarded and the PEs are released back into the allocation pool. It does not wipe the area (which you somehow assumed as far as I understand your post).

Think of this, once you delete a partition table and recreate it with the same layout, all filesystems will be available, if the drive was not touched in any way.

The question seems to be: What is your actual intention?

Regards

-Sven

Quoted 43 lines · Guy Rouillier

I'm using xen-create-image in an attempt to set up a new VM; host OS is Ubuntu Server 13.10, and I'm using LVM. I failed in my first attempt due to my inexperience, so I changed some input parameters and I'm trying again. The first attempt had successfully created the target LVM volumes for boot, root and swap, so I used lvremove to delete them. All that went without error.

However, now when I try to run xen-create-image, I get the following error at the beginning when xen-create-image tries to create the target volumes:

Creating btrfs filesystem on /dev/dell-vg/oraclelinux-root /dev/dell-vg/oraclelinux-root appears to contain an existing filesystem (btrfs).
Error: Use the -f option to force overwrite.
Running command 'mkfs.btrfs /dev/dell-vg/oraclelinux-root 2>&1' failed with exit code 256.
Aborting

I've tried searching for this error but can't find anything helpful. I've rerun this a dozen times and get the same result each time (deleting the created volumes and rebooting between each attempt.) I looked in the /dev tree, and I see the dm node (dm-4) disappears after I run lvremove. But apparently, lvremove doesn't delete the filesystem. So when I recreate the same volume in the same order, the filesystem is still there from the previous attempt.

How do I fix this? Thanks.

--
Guy Rouillier

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#2 lore raw
Quoted 3 lines · Sven Eschenberg

Think of this, once you delete a partition table and recreate it with the same layout, all filesystems will be available, if the drive was not touched in any way.

Although lvcreate has a --zero option enabled by default that wipes the beginning of the new device (and the next upstream release extends this to wipe more signatures using libblkid).

You need to investigate precisely how your version of 'xen-create-image' is using LVM and with which options.

Alasdair

#3 lore raw
Quoted 9 lines · Alasdair G Kergon
Quoted 4 lines · Sven Eschenberg

Think of this, once you delete a partition table and recreate it with the
same layout, all filesystems will be available, if the drive was not touched in any way.

Although lvcreate has a --zero option enabled by default that wipes the beginning of the new device (and the next upstream release extends this to wipe more signatures using libblkid).

Forgot about that. Then again my documentation says zero wipes the first KB, which does not really catch BTRFS sigs (which the OP uses) nor various mdraid signatures.

I honestly hope the libblkid dependency will be optional ;-).

Quoted 4 lines

You need to investigate precisely how your version of 'xen-create-image' is
using LVM and with which options.

The actual OP, you meant. As you noted in your other post wipefs can come in handy. Additionally blkid and lsblk are two things that come in handy, to see what is going on.

Quoted 3 lines

Alasdair

-Sven

#4 lore raw
In reply to Guy Rouillier
Quoted 3 lines · Guy Rouillier

/dev/dell-vg/oraclelinux-root appears to contain an existing filesystem (btrfs).
Error: Use the -f option to force overwrite.

Does your version of xen-create-image offer a way to supply that -f?

If you're running lvremove yourself before retrying, look into running wipefs manually on the device first.

Alasdair

#5 lore raw
Quoted 6 lines · Alasdair G Kergon
Quoted 3 lines · Guy Rouillier

/dev/dell-vg/oraclelinux-root appears to contain an existing filesystem (btrfs).
Error: Use the -f option to force overwrite.

Does your version of xen-create-image offer a way to supply that -f?

I tried supplying the -f option to xen-create-image. Unfortunately, it did not alter the outcome.

Quoted 3 lines

If you're running lvremove yourself before retrying, look into running wipefs manually on the device first.

Thank you, that solved the problem. I was then able to run xen-create-image again and it recreated the LVs. To answer Sven's question: "What is your actual intention?", I'm trying to rerun xen-create-image so that I can create this xen virtual machine. I could not do that because it failed trying to recreate the root LV.

Signature · 5 lines
Guy Rouillier

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
#6 lore raw

I guess my question was somewhat misleading:

I was not sure, if you had some data to keep, or if you'd planned to trash everything. Usually the warning about an existing FS is not a coincidence, so better make sure, people really intend to wipe it ;-).

-Sven

Quoted 25 lines · Guy Rouillier
Quoted 3 lines · Alasdair G Kergon

If you're running lvremove yourself before retrying, look into running wipefs manually on the device first.

Thank you, that solved the problem. I was then able to run xen-create-image again and it recreated the LVs. To answer Sven's
question: "What is your actual intention?", I'm trying to rerun xen-create-image so that I can create this xen virtual machine. I could not do that because it failed trying to recreate the root LV.

--
Guy Rouillier

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/