~ubuntu-branches/ubuntu/precise/util-linux/precise

« back to all changes in this revision

Viewing changes to disk-utils/mkswap.8

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2011-12-16 22:53:42 UTC
  • mfrom: (1.6.4) (4.5.5 sid)
  • Revision ID: package-import@ubuntu.com-20111216225342-206wz4bhvutyvx0d
Tags: 2.20.1-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Build for multiarch.
  - Add pre-depends on multiarch-support.
  - configure.ac: don't try to be clever about extracting a path name from
    $libdir to append to /usr in a way that's not overridable; instead,
    reuse the built-in configurable libexecdir.
  - Fix up the .pc.in files to know about libexecdir, so our substitutions
    don't leave us with unusable pkg-config files.
  - Install custom blkid.conf to use /dev/.blkid.tab since we don't
    expect device names to survive a reboot
  - Mention mountall(8) in fstab(5) manpages, along with its special
    options.
  - Since upstart is required in Ubuntu, the hwclock.sh init script is not
    called on startup and the hwclockfirst.sh init script is removed.
  - Drop depends on initscripts for the above.
  - Replace hwclock udev rule with an Upstart job.
  - For the case where mount is called with a directory to mount, look
    that directory up in mountall's /lib/init/fstab if we couldn't find
    it mentioned anywhere else.  This means "mount /proc", "mount /sys",
    etc. work.
  - mount.8 points to the cifs-utils package, not the obsolete smbfs one. 
  - Use canonicalize_spec in getmntdevbackward. proc should not be
    interpreted as a non-canonical-path.
* Dropped changes, superseded upstream:
  - shlibs/mount/src/tab_update.c: don't refuse to update mtab when source
    is 'none'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
.\" May be distributed under the GNU General Public License
4
4
.\" Rewritten for 2.1.117, aeb, 981010.
5
5
.\"
6
 
.TH MKSWAP 8 "13 March 2009" "Linux" "Linux Programmer's Manual"
 
6
.TH MKSWAP 8 "March 2009" "util-linux" "System Administration"
7
7
.SH NAME
8
8
mkswap \- set up a Linux swap area
9
9
.SH SYNOPSIS
10
10
.B mkswap
11
 
.RB [ \-c ]
12
 
.RB [ \-f ]
13
 
.RB [ \-p
14
 
.IR PSZ ]
15
 
.RB [ \-L
16
 
.IR label ]
17
 
.RB [ \-U
18
 
.IR uuid ]
 
11
.RI [ options ]
19
12
.I device
20
13
.RI [ size ]
21
14
.SH DESCRIPTION
41
34
will use the entire partition or file if it is omitted.
42
35
Specifying it is unwise -- a typo may destroy your disk.)
43
36
 
44
 
The
45
 
.I PSZ
46
 
parameter specifies the page size to use.  It is almost always
47
 
unnecessary (even unwise) to specify it, but certain old libc
48
 
versions lie about the page size, so it is possible that
49
 
.B mkswap
50
 
gets it wrong.  The symptom is that a subsequent
51
 
.B swapon
52
 
fails because no swap signature is found.  Typical values for
53
 
.I PSZ
54
 
are 4096 or 8192.
55
 
 
56
37
After creating the swap area, you need the
57
38
.B swapon
58
39
command to start using it.  Usually swap areas are listed in
66
47
can be there, but it is not a recommended setup.  The recommended setup is to
67
48
use a separate partition for a Linux swap area.
68
49
 
69
 
.B mkswap, like many others mkfs-like utils, erases the first block to remove
70
 
.B old on-disk filesystems.
 
50
.BR mkswap ,
 
51
like many others mkfs-like utils,
 
52
.B erases the first partition block to make any previous filesystem invisible.
71
53
 
 
54
However,
72
55
.B mkswap
73
56
refuses to erase the first block on a device with a disk
74
 
label (SUN, BSD, ...) or on a whole disk (e.g. /dev/sda).
 
57
label (SUN, BSD, ...) and on a whole disk (e.g. /dev/sda).
75
58
 
76
59
.SH OPTIONS
77
60
.TP
78
 
.B \-c
 
61
.BR \-c , " \-\-check"
79
62
Check the device (if it is a block device) for bad blocks
80
63
before creating the swap area.
81
 
If any are found, the count is printed.
 
64
If any bad blocks are found, the count is printed.
82
65
.TP
83
 
.B \-f
84
 
Force -- go ahead even if the command is stupid.
 
66
.BR \-f , " \-\-force"
 
67
Go ahead even if the command is stupid.
85
68
This allows the creation of a swap area larger than the file
86
69
or partition it resides on.
87
70
 
88
 
Without this option,
 
71
Also, without this option,
89
72
.B mkswap
90
 
will refuse to erase the first block on a device with a partition table or on
 
73
will refuse to erase the first block on a device with a partition table and on
91
74
a whole disk (e.g. /dev/sda).
92
75
.TP
93
 
.BI \-L \ label
94
 
Specify a label, to allow
 
76
.BR \-L , " \-\-label " \fIlabel\fR
 
77
Specify a \fIlabel\fR for the device, to allow
95
78
.B swapon
96
79
by label.
97
80
.TP
98
 
.BI \-p \ PSZ
99
 
Specify the page size (in bytes) to use.  This option is usually unnecessary,
 
81
.BR \-p , " \-\-pagesize " \fIsize\fR
 
82
Specify the page \fIsize\fR (in bytes) to use.  This option is usually unnecessary;
100
83
.B mkswap
101
84
reads the size from the kernel.
102
85
.TP
103
 
.BI \-U \ uuid
104
 
Specify the uuid to use.  The default is to generate a UUID.
105
 
.TP
106
 
.BR \-v1
107
 
Specify the swap-space version.  The old \-v0 option has become obsolete
108
 
and now only \-v1 is supported.
109
 
 
110
 
The kernel has not supported v0 swap-space format since 2.5.22.
111
 
The new version v1 is supported since 2.1.117.
 
86
.BR \-U , " \-\-uuid " \fIUUID\fR
 
87
Specify the \fIUUID\fR to use.  The default is to generate a UUID.
 
88
.TP
 
89
.BR \-v , " \-\-swapversion 1"
 
90
Specify the swap-space version.  (This option is currently pointless, as the old
 
91
.B \-v 0
 
92
option has become obsolete and now only
 
93
.B \-v 1
 
94
is supported.
 
95
The kernel has not supported v0 swap-space format since 2.5.22 (June 2002).
 
96
The new version v1 is supported since 2.1.117 (August 1998).)
 
97
.TP
 
98
.BR \-h , " \-\-help"
 
99
Display help text and exit.
 
100
.TP
 
101
.BR \-V , " \-\-version"
 
102
Display version information and exit.
112
103
 
113
104
.SH NOTES
114
105
The maximum useful size of a swap area depends on the architecture and
115
106
the kernel version.
116
107
It is roughly 2GiB on i386, PPC, m68k and ARM, 1GiB on sparc, 512MiB on mips,
117
 
128GiB on alpha, and 3TiB on sparc64.  For kernels after 2.3.3 there is no
 
108
128GiB on alpha, and 3TiB on sparc64.  For kernels after 2.3.3 (May 1999) there is no
118
109
such limitation.
119
110
 
120
111
Note that before version 2.1.117 the kernel allocated one byte for each page,
121
112
while it now allocates two bytes, so that taking into use a swap area of 2 GiB
122
113
might require 2 MiB of kernel memory.
123
114
 
124
 
Presently, Linux allows 32 swap areas (this was 8 before Linux 2.4.10).
 
115
Presently, Linux allows 32 swap areas (this was 8 before Linux 2.4.10 (Sep 2001)).
125
116
The areas in use can be seen in the file
126
117
.I /proc/swaps
127
 
(since 2.1.25).
 
118
(since 2.1.25 (Sep 1997)).
128
119
 
129
120
.B mkswap
130
121
refuses areas smaller than 10 pages.