Discussion:
[linux-lvm] lvremove is not deleting the file system
Guy Rouillier
2013-12-30 00:58:04 UTC
Permalink
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
Sven Eschenberg
2013-12-30 01:46:45 UTC
Permalink
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
Post by 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
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
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Alasdair G Kergon
2013-12-30 01:55:55 UTC
Permalink
Post by 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
Sven Eschenberg
2013-12-30 02:27:19 UTC
Permalink
Post by Alasdair G Kergon
Post by 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 ;-).
Post by Alasdair G Kergon
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.
Post by Alasdair G Kergon
Alasdair
-Sven
Alasdair G Kergon
2013-12-30 02:00:26 UTC
Permalink
Post by 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
Guy Rouillier
2013-12-30 03:28:36 UTC
Permalink
Post by Alasdair G Kergon
Post by 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.
Post by 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
Sven Eschenberg
2013-12-30 05:18:44 UTC
Permalink
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
Post by Guy Rouillier
Post by 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
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/
Loading...