I performed the following procedure in order to add 400m to swap,
I took the 400m from the sdb disk for the swap increasing
Everything was ok but before the last command , I performed
mkswap /dev/rootvg/swap
And I get the following warning messages from mkswap
mkswap: /dev/rootvg/swap: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 2490364 KiB
no label, UUID=2f42fa37-987d-40a5-8cf6-5707e1d8f077
Finally swap was extend to 2.4G as expected
But I little worry about the warning message from mkswap command
Please advise what is meaning of the warning:
mkswap: /dev/rootvg/swap: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
And if this is OK?
My procedure on the linux redhat machine - version 6
# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2064380 0 -1
# free
total used free shared buffers cached
Mem: 5991892 539036 5452856 212 70444 270664
-/+ buffers/cache: 197928 5793964
Swap: 2064380 0 2064380
# pvs
PV VG Fmt Attr PSize PFree
/dev/sdb rootvg lvm2 a--u 7.97g 416.00m
/dev/sdc orahome lvm2 a--u 30.00g 15.00g
# lsblk /dev/sdb
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 8G 0 disk
|-rootvg-swap (dm-1) 253:1 0 2G 0 lvm [SWAP]
|-rootvg-slash (dm-2) 253:2 0 576M 0 lvm /
|-rootvg-usr (dm-3) 253:3 0 1.4G 0 lvm /usr
|-rootvg-home (dm-4) 253:4 0 256M 0 lvm /home
|-rootvg-opt (dm-5) 253:5 0 416M 0 lvm /opt
`-rootvg-var (dm-6) 253:6 0 3G 0 lvm /var
# swapon -s
Filename Type Size Used Priority
/dev/dm-1 partition 2064380 0 -1
# swapoff /dev/rootvg/swap
# lvresize /dev/rootvg/swap -L +400m
Rounding size to boundary between physical extents: 416.00 MiB.
Size of logical volume rootvg/swap changed from 1.97 GiB (63 extents) to 2.38 GiB (76 extents).
Logical volume swap successfully resized.
# mkswap /dev/rootvg/swap
mkswap: /dev/rootvg/swap: warning: don't erase bootbits sectors
on whole disk. Use -f to force.
Setting up swapspace version 1, size = 2490364 KiB
no label, UUID=2f42fa37-987d-40a5-8cf6-5707e1d8f077
# swapon /dev/rootvg/swap
# free
total used free shared buffers cached
Mem: 5991892 539680 5452212 212 70536 270892
-/+ buffers/cache: 198252 5793640
Swap: 2490364 0 2490364
Looks like a safety precaution to prevent you from destroying a boot sector, etc... when using a whole disk when you may have meant to use a partition.
This warning message not longer present in CentOS 6.5 nor Ubuntu 16.04.
This older (2006)
mkswap.c
defines bootbits vaguely: http://code.metager.de/source/xref/busybox/util-linux/mkswap.cFrom the CentOS 6.5
mkswap.c
:I'm not amazing with C, but the new code appears more intelligent and perhaps preserves boot data. I'm not delving that far.