Bug 120607

Summary: mkswap refuses to make swap on disk device
Product: [Retired] Red Hat Linux Reporter: Tom de Vries <seirvedmot>
Component: util-linuxAssignee: Elliot Lee <sopwith>
Status: CLOSED WONTFIX QA Contact: Ben Levenson <benl>
Severity: low Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-05-26 23:02:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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)
Gecko/20030225

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))
                check=0;
        /*
        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):
util-linux-2.11y-9

How reproducible:
Always

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

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 :)