Bug 120607 - mkswap refuses to make swap on disk device
Summary: mkswap refuses to make swap on disk device
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: util-linux
Version: 9
Hardware: i386
OS: Linux
medium
low
Target Milestone: ---
Assignee: Elliot Lee
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
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:
Clone Of:
Environment:
Last Closed: 2004-05-26 23:02:14 UTC
Embargoed:


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


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