Discussion:
[linux-lvm] pvcreate: vfat signature detected on /dev/sda5
John L. Poole
2016-12-10 03:35:24 UTC
Permalink
I have a new 4TB disk on a new server which I'm installing Xen on.
I've always intended that I use whatever small partitions to get a
system up and running
and then dedicate the remaining balance of the disk to LVM.

After much hassle I finally got my Xen instance up on this EUFI based unit,
and I created a new partition, /dev/sda5, using fsdisk.

When I tried to create a new volume, I received a warning about
a vfat signature. I aborted.

Note: /dev/sda2 is a VFAT system which is required by EFI.

I had not previously create sda5, I just created sda1 - sda4 until
I finally had a dom0 server operating.

Here's the layout of the disk:

Device Start End Sectors Size Type
/dev/sda1 2048 6143 4096 2M BIOS boot
/dev/sda2 6144 268287 262144 128M EFI System
/dev/sda3 268288 1316863 1048576 512M Linux filesystem
/dev/sda4 1316864 42272767 40955904 19.5G Linux filesystem
/dev/sda5 42272768 7814037134 7771764367 3.6T Linux LVM

Here's my attempt to create a physical volume:

zeta jlpoole # pvcreate /dev/sda5
WARNING: vfat signature detected on /dev/sda5 at offset 54. Wipe it?
[y/n]: n
Aborted wiping of vfat.
1 existing signature left on the device.
Aborting pvcreate on /dev/sda5.
zeta jlpoole #

Is the warning something I need to be concerned about when
creating a physical volume on /dev/sda5? I'm wondering if it was
looking at another
partition and bubbling up just as a precaution.

Thank you,

John
Xen
2016-12-10 07:01:52 UTC
Permalink
Post by John L. Poole
zeta jlpoole # pvcreate /dev/sda5
WARNING: vfat signature detected on /dev/sda5 at offset 54. Wipe it?
[y/n]: n
Aborted wiping of vfat.
1 existing signature left on the device.
Aborting pvcreate on /dev/sda5.
zeta jlpoole #
Is the warning something I need to be concerned about when
creating a physical volume on /dev/sda5? I'm wondering if it was
looking at another
partition and bubbling up just as a precaution.
I am assuming this is a pretty standard thing; and nothing you need to
worry about. If you wanted to be sure, you could create a dd of the 2nd
partition, or of the first 131 MB.

Then after PV create you could do a diff on the saved data and the real
data still on disk, but I am going to assume -- as a layman -- that LVM
is not messing up the messages; it is really talking about sda5, and
there is nothing going to happen. I encounter spurious signatures all
the time, most of the time I do not even worry how it got there.

Regards.
Bryn M. Reeves
2016-12-10 10:37:06 UTC
Permalink
Post by John L. Poole
zeta jlpoole # pvcreate /dev/sda5
WARNING: vfat signature detected on /dev/sda5 at offset 54. Wipe it?
[y/n]: n
Aborted wiping of vfat.
1 existing signature left on the device.
Aborting pvcreate on /dev/sda5.
zeta jlpoole #
If you want to confirm what's present on a device, use the blkid or
file commands:

# blkid /dev/sda1
/dev/sda1: UUID="49f9b992-3c68-4b59-a232-e1a3a4482eed" TYPE="ext4" PARTUUID="000298d0-01"

# file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=49f9b992-3c68-4b59-a232-e1a3a4482eed (needs journal recovery) (extents) (large files) (huge files)

You can also use the wipefs program to manually remove any signature,
and optionally back it up to a file so that it can be restored (it
will also report label offsets as with pvcreate).

Both blkid and wipefs are from util-linux. The file program comes
from the 'file' package on most distros.

Regards,
Bryn.
Peter Rajnoha
2016-12-12 10:01:09 UTC
Permalink
Post by Bryn M. Reeves
Post by John L. Poole
zeta jlpoole # pvcreate /dev/sda5
WARNING: vfat signature detected on /dev/sda5 at offset 54. Wipe it?
[y/n]: n
Aborted wiping of vfat.
1 existing signature left on the device.
Aborting pvcreate on /dev/sda5.
zeta jlpoole #
If you want to confirm what's present on a device, use the blkid or
# blkid /dev/sda1
/dev/sda1: UUID="49f9b992-3c68-4b59-a232-e1a3a4482eed" TYPE="ext4" PARTUUID="000298d0-01"
# file -s /dev/sda1
/dev/sda1: Linux rev 1.0 ext4 filesystem data, UUID=49f9b992-3c68-4b59-a232-e1a3a4482eed (needs journal recovery) (extents) (large files) (huge files)
You can also use the wipefs program to manually remove any signature,
and optionally back it up to a file so that it can be restored (it
will also report label offsets as with pvcreate).
Both blkid and wipefs are from util-linux. The file program comes
from the 'file' package on most distros.
LVM uses libblkid (which is from util-linux) and calls the signature detection code from this library. So this is exactly the same code as blkid and wipefs uses - they both use this library too.

You may see such warning with pvcreate (as in the scenario reported here) as well as with lvcreate where LVM runs this signature detection code from libbblkid on newly created LV data area. It's OK to run wipefs yourself before calling pvcreate, like Bryn mentioned. However, when creating new LVs and when you hit this warning, I recommend answering "yes" to wipe the signature because otherwise there may be udev hook which would automatically activate whatever old signature there was from any previous use in just allocated LV's data area (IOW, with pvcreate, you know the offset - the PV signature is written at the beginning of the disk. But with lvcreate, the LV data area is allocated in runtime and the offset and segments are calculated during that lvcreate so you never know with what offset and where to call wipefs before calling lvcreate - it's quite low level action anyway).

For example:

(just calling this to create an FS signature and simulate old signature for the lvcreate later)

# lvcreate -l1 vg
Logical volume "lvol0" created.

# mkfs /dev/vg/lvol0
mke2fs 1.43.3 (04-Sep-2016)
Discarding device blocks: done
Creating filesystem with 4096 1k blocks and 1024 inodes

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

# lvremove -ff vg

(and now, let's call lvcreate which "by chance" finds old FS signature)

# lvcreate -l1 vg
WARNING: ext2 signature detected on /dev/vg/lvol0 at offset 1080. Wipe it? [y/n]:
Wiping ext2 signature on /dev/vg/lvol0.
Logical volume "lvol0" created.

If you answered "n" for the question above, LVM would not remove the old signature and if there's a hook in udev by chance which, for example, does automatic mounting, you could end up with unexpected behavior where you have these automatic actions firing in background without you knowing about them. This is just an example, but it applies to any other signatures too. If you answer "y" here, LVM activates the LV with a flag marking that device as private temporarily so udev does not scan the LV's data area yet and hence there shouldn't be any automatic actions in background based on the event. Then LVM calls the libbblkid's "wipefs" code to wipe any signatures it finds and after that it drops the "private" flag and hence any udev hook (or anyone listening on udev events) sees newly created LV with clean data area, which is what we expect normally.

So this is just for completeness that you can hit the warning with pvcreate as well as with lvcreate where it's even more important. LVM does this cleanup job for you.
--
Peter
Loading...