Red Hat Bugzilla – Bug 120607
mkswap refuses to make swap on disk device
Last modified: 2007-04-18 13:05:50 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1)
Description of problem:
I tried to make a swap device of my old hd, but mkswap
wouldn't let me.
Commenting out the else clause of the following code in mkswap.c let's
me create the swap device just as I want.
/* Want a block device. Probably not /dev/hda or /dev/hdb. */
else if (statbuf.st_rdev == 0x0300 || statbuf.st_rdev == 0x0340)
die(_("Will not try to make swapdevice on %s"));
The commment in the code states the behaviour was intentional, however
it is implemented too restrictive. If will be good to have the check
as a safety precaution, but maybe the -f (force) switch could be used
to force the command anyway.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. type mkswap /dev/hd<x>, where x is an installed hd without any
Actual Results: [root@tjvries disk-utils]# mkswap /dev/hdb
mkswap: Will not try to make swapdevice on '%s'
Note: even the error message is wrong...
Expected Results: [root@tjvries disk-utils]# ./mkswap /dev/hdb
Setting up swapspace version 1, size = 1624666 kB
This is the behaviour with my privately build and fixed
The solution is to make an hdb1 swap partition that includes the whole
disk space. It may waste a few K of space, but it will keep the kernel
and disk utils a lot happier. Hopefully losing a little space out of
1.5G won't hurt too much :)