Bug 120607 - mkswap refuses to make swap on disk device
Summary: mkswap refuses to make swap on disk device
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: util-linux   
(Show other bugs)
Version: 9
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Elliot Lee
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2004-04-11 22:51 UTC by Tom de Vries
Modified: 2007-04-18 17:05 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-05-26 23:02:14 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Tom de Vries 2004-04-11 22:51:58 UTC
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. */
        if (!S_ISBLK(statbuf.st_mode))
        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):

How reproducible:

Steps to Reproduce:
1. type mkswap /dev/hd<x>, where x is an installed hd without any
useful data

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
mkswap binary

Additional info:

Comment 1 Elliot Lee 2004-05-26 23:02:14 UTC
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 :)

Note You need to log in before you can comment on or make changes to this bug.