FAQ
Hello,

I am confused by a warning from mkswap :

When making a swap on a LVM volume, I see the following warning :
mkswap: /dev/vg_SDB1/swap_test6_64: warning: don't erase bootbits
sectors on whole disk. Use -f to force.
Setting up swapspace version 1, size = 1048572 KiB

Is it safe to use mkswap -f in this case ?
(If that matters, the swap is intended for a virtual machine, and
the host where I am using mkswap is a CentOS-6 server.)

Thanks,

--
Philippe Naudin

Search Discussions

  • Peter Kjellström at Mar 13, 2012 at 1:08 pm

    On Tuesday 13 March 2012 13.41.53 Philippe Naudin wrote:
    Hello,

    I am confused by a warning from mkswap :

    When making a swap on a LVM volume, I see the following warning :
    mkswap: /dev/vg_SDB1/swap_test6_64: warning: don't erase bootbits
    sectors on whole disk. Use -f to force.
    Setting up swapspace version 1, size = 1048572 KiB

    Is it safe to use mkswap -f in this case ?
    I'd say it's safe but why do it?

    What likely happened is that the lv you ran mkswap on contained a valid
    partition table (or at least boot signature). Out of paranoia mkswap left the
    first block alone. So what you could gain is maybe another 512 byte in
    swapspace by adding -f.

    You could write a meg of zeroes to the device first and see if the mkswap
    warning goes away.

    /Peter
    (If that matters, the swap is intended for a virtual machine, and
    the host where I am using mkswap is a CentOS-6 server.)

    Thanks,
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 198 bytes
    Desc: This is a digitally signed message part.
    Url : http://lists.centos.org/pipermail/centos/attachments/20120313/7e43cb89/attachment.bin
  • Mark Roth at Mar 13, 2012 at 1:20 pm

    Peter Kjellstr?m wrote:
    On Tuesday 13 March 2012 13.41.53 Philippe Naudin wrote:
    Hello,

    I am confused by a warning from mkswap :

    When making a swap on a LVM volume, I see the following warning :
    mkswap: /dev/vg_SDB1/swap_test6_64: warning: don't erase bootbits
    sectors on whole disk. Use -f to force.
    Setting up swapspace version 1, size = 1048572 KiB

    Is it safe to use mkswap -f in this case ?
    I'd say it's safe but why do it?

    What likely happened is that the lv you ran mkswap on contained a valid
    partition table (or at least boot signature). Out of paranoia mkswap left
    the first block alone. So what you could gain is maybe another 512 byte in
    swapspace by adding -f.
    <snip>
    Are you making swap from a logical partition, or a swapfile? If the
    former, perhaps recreating the partition might help.

    mark
  • Peter Kjellström at Mar 14, 2012 at 4:08 am

    On Tuesday 13 March 2012 13.20.01 m.roth at 5-cent.us wrote:
    Peter Kjellstr?m wrote:
    On Tuesday 13 March 2012 13.41.53 Philippe Naudin wrote:
    Hello,

    I am confused by a warning from mkswap :

    When making a swap on a LVM volume, I see the following warning :
    mkswap: /dev/vg_SDB1/swap_test6_64: warning: don't erase bootbits
    ...
    <snip>
    Are you making swap from a logical partition, or a swapfile? If the
    former, perhaps recreating the partition might help.
    Don't confuse the poor guy. 1) yes he's doing mkswap on an lv which was
    obvious had you read the post 2) an lv does not have a partition table so your
    statement about recreating it makes no sense.

    /Peter
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 198 bytes
    Desc: This is a digitally signed message part.
    Url : http://lists.centos.org/pipermail/centos/attachments/20120314/f2d19d9c/attachment.bin
  • Philippe Naudin at Mar 14, 2012 at 6:50 am

    Le mer. 14 mars 2012 09:08:46 CET, Peter Kjellstr?m a ?crit:
    On Tuesday 13 March 2012 13.20.01 m.roth at 5-cent.us wrote:
    Peter Kjellstr?m wrote:
    On Tuesday 13 March 2012 13.41.53 Philippe Naudin wrote:
    Hello,

    I am confused by a warning from mkswap :

    When making a swap on a LVM volume, I see the following warning :
    mkswap: /dev/vg_SDB1/swap_test6_64: warning: don't erase bootbits
    ...
    <snip>
    Are you making swap from a logical partition, or a swapfile? If the
    former, perhaps recreating the partition might help.
    Don't confuse the poor guy. 1) yes he's doing mkswap on an lv which was
    obvious had you read the post 2) an lv does not have a partition table so your
    statement about recreating it makes no sense.
    Thanks all for your answers.

    Actually, my problem concern lvm, not mkswap. I don't know yet if I
    have completely messed with vgcreate/lvcreate or if what I get is due
    to some difference between CentOS-5 and CentOS-6, but all my logical
    volumes seem to appear as distinct disks.

    On a CentOS-6 machine :

    $ lvcreate -L 10M --name try_lvcreate --zero=y VolGroup
    Rounding up size to full physical extent 12.00 MiB
    Logical volume "try_lvcreate" created

    $ fdisk -l
    <snip the "normal" partitions table for /dev/sda>

    Disk /dev/mapper/VolGroup-try_lvcreate: 12 MB, 12582912 bytes
    255 heads, 63 sectors/track, 1 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Disk /dev/mapper/VolGroup-try_lvcreate doesn't contain a valid partition table

    $ mkswap /dev/mapper/VolGroup-try_lvcreate
    mkswap: /dev/mapper/VolGroup-try_lvcreate: warning: don't erase bootbits sectors
    on whole disk. Use -f to force.
    Setting up swapspace version 1, size = 12284 KiB
    no label, UUID=be229ca5-bcb9-4116-87fc-8878abb44742

    The same commands on a CentOS-5 machine give me a completely
    different output. Can you guess where I have messed, or is this
    behavior correct on CentOS-6 ?

    Thanks,

    --
    Philippe Naudin
  • Peter Kjellström at Mar 14, 2012 at 1:14 pm

    On Wednesday 14 March 2012 11.50.37 Philippe Naudin wrote:
    Thanks all for your answers.

    Actually, my problem concern lvm, not mkswap.
    No, afaict there's nothing wrong with your lvm. The only problem I see is that
    mkswap prints our an incorrect or at least pointless warning.

    I can confirm that mkswap on an lv on one of my test machines also says
    "warning: don't erase bootbits...". It also says this when running against a
    file full of zeroes...

    Regarding fdisks complaints about "doesn't contain a valid partition
    table...", this is normal (and may be considered a bug in the "-l" option, it
    could have excluded lvm-devices from its list...).

    If you want to get to the bottom of this I suspect the easiest way is to look
    at the mkswap source code (under which circumstances it prints that message).

    /Peter
    -------------- next part --------------
    A non-text attachment was scrubbed...
    Name: not available
    Type: application/pgp-signature
    Size: 198 bytes
    Desc: This is a digitally signed message part.
    Url : http://lists.centos.org/pipermail/centos/attachments/20120314/1674967c/attachment.bin
  • Philippe Naudin at Mar 15, 2012 at 4:32 am

    Le mer. 14 mars 2012 18:14:31 CET, Peter Kjellstr?m a ?crit:
    On Wednesday 14 March 2012 11.50.37 Philippe Naudin wrote:
    Thanks all for your answers.

    Actually, my problem concern lvm, not mkswap.
    No, afaict there's nothing wrong with your lvm. The only problem I see is that
    mkswap prints our an incorrect or at least pointless warning.

    I can confirm that mkswap on an lv on one of my test machines also says
    "warning: don't erase bootbits...". It also says this when running against a
    file full of zeroes...

    Regarding fdisks complaints about "doesn't contain a valid partition
    table...", this is normal (and may be considered a bug in the "-l" option, it
    could have excluded lvm-devices from its list...).

    If you want to get to the bottom of this I suspect the easiest way is to look
    at the mkswap source code (under which circumstances it prints that message).
    Ahh, perfect, thanks a lot. These bugs^W features of fdisk and mkswap
    were absent of CentOS-5 : I was lost, wondering what can be my
    mistakes.

    Thanks again,

    --
    Philippe Naudin

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcentos @
categoriescentos
postedMar 13, '12 at 8:41a
activeMar 15, '12 at 4:32a
posts7
users3
websitecentos.org
irc#centos

People

Translate

site design / logo © 2022 Grokbase