Index: sbin/swapon/swapon.c =================================================================== --- sbin/swapon/swapon.c +++ sbin/swapon/swapon.c @@ -761,8 +761,8 @@ } else errx(1, "%s has an invalid file type", name); /* Trim the device. */ - ioarg[0] = 0; - ioarg[1] = sz; + ioarg[0] = BSD_LABEL_SIZE; + ioarg[1] = sz - BSD_LABEL_SIZE; if (ioctl(fd, DIOCGDELETE, ioarg) != 0) warn("ioctl(DIOCGDELETE)"); Index: sys/vm/swap_pager.c =================================================================== --- sys/vm/swap_pager.c +++ sys/vm/swap_pager.c @@ -2298,10 +2298,10 @@ sp->sw_blist = blist_create(nblks, M_WAITOK); /* - * Do not free the first two block in order to avoid overwriting + * Do not free the first blocks in order to avoid overwriting * any bsd label at the front of the partition */ - blist_free(sp->sw_blist, 2, nblks - 2); + blist_free(sp->sw_blist, BSD_LABEL_SIZE, nblks - BSD_LABEL_SIZE); dvbase = 0; mtx_lock(&sw_dev_mtx); @@ -2319,7 +2319,7 @@ sp->sw_end = dvbase + nblks; TAILQ_INSERT_TAIL(&swtailq, sp, sw_list); nswapdev++; - swap_pager_avail += nblks - 2; + swap_pager_avail += nblks - BSD_LABEL_SIZE; swap_total += nblks; swapon_check_swzone(); swp_sizecheck(); Index: sys/vm/vm_param.h =================================================================== --- sys/vm/vm_param.h +++ sys/vm/vm_param.h @@ -122,6 +122,10 @@ #endif /* !SMP */ #endif /* !PA_LOCK_COUNT */ +#ifndef BSD_LABEL_SIZE +#define BSD_LABEL_SIZE 2 +#endif BSD_LABEL_SIZE + #ifndef KSTACK_MAX_PAGES #define KSTACK_MAX_PAGES 32 #endif