OSDN Git Service

util-linux 2.38: 翻訳予約。
[linuxjm/jm.git] / manual / util-linux / original / man8 / mkswap.8
1 '\" t
2 .\"     Title: mkswap
3 .\"    Author: [see the "AUTHOR(S)" section]
4 .\" Generator: Asciidoctor 2.0.15
5 .\"      Date: 2022-02-17
6 .\"    Manual: System Administration
7 .\"    Source: util-linux 2.38
8 .\"  Language: English
9 .\"
10 .TH "MKSWAP" "8" "2022-02-17" "util\-linux 2.38" "System Administration"
11 .ie \n(.g .ds Aq \(aq
12 .el       .ds Aq '
13 .ss \n[.ss] 0
14 .nh
15 .ad l
16 .de URL
17 \fI\\$2\fP <\\$1>\\$3
18 ..
19 .als MTO URL
20 .if \n[.g] \{\
21 .  mso www.tmac
22 .  am URL
23 .    ad l
24 .  .
25 .  am MTO
26 .    ad l
27 .  .
28 .  LINKSTYLE blue R < >
29 .\}
30 .SH "NAME"
31 mkswap \- set up a Linux swap area
32 .SH "SYNOPSIS"
33 .sp
34 \fBmkswap\fP [options] \fIdevice\fP [\fIsize\fP]
35 .SH "DESCRIPTION"
36 .sp
37 \fBmkswap\fP sets up a Linux swap area on a device or in a file.
38 .sp
39 The \fIdevice\fP argument will usually be a disk partition (something like \fI/dev/sdb7\fP) but can also be a file. The Linux kernel does not look at partition IDs, but many installation scripts will assume that partitions of hex type 82 (LINUX_SWAP) are meant to be swap partitions. (\fBWarning: Solaris also uses this type. Be careful not to kill your Solaris partitions.\fP)
40 .sp
41 The \fIsize\fP parameter is superfluous but retained for backwards compatibility. (It specifies the desired size of the swap area in 1024\-byte blocks. \fBmkswap\fP will use the entire partition or file if it is omitted. Specifying it is unwise \- a typo may destroy your disk.)
42 .sp
43 After creating the swap area, you need the \fBswapon\fP(8) command to start using it. Usually swap areas are listed in \fI/etc/fstab\fP so that they can be taken into use at boot time by a \fBswapon \-a\fP command in some boot script.
44 .SH "WARNING"
45 .sp
46 The swap header does not touch the first block. A boot loader or disk label can be there, but it is not a recommended setup. The recommended setup is to use a separate partition for a Linux swap area.
47 .sp
48 \fBmkswap\fP, like many others mkfs\-like utils, \fBerases the first partition block to make any previous filesystem invisible.\fP
49 .sp
50 However, \fBmkswap\fP refuses to erase the first block on a device with a disk label (SUN, BSD, ...).
51 .SH "OPTIONS"
52 .sp
53 \fB\-c\fP, \fB\-\-check\fP
54 .RS 4
55 Check the device (if it is a block device) for bad blocks before creating the swap area. If any bad blocks are found, the count is printed.
56 .RE
57 .sp
58 \fB\-f\fP, \fB\-\-force\fP
59 .RS 4
60 Go ahead even if the command is stupid. This allows the creation of a swap area larger than the file or partition it resides on.
61 .sp
62 Also, without this option, \fBmkswap\fP will refuse to erase the first block on a device with a partition table.
63 .RE
64 .sp
65 \fB\-q\fP, \fB\-\-quiet\fP
66 .RS 4
67 Suppress output and warning messages.
68 .RE
69 .sp
70 \fB\-L\fP, \fB\-\-label\fP \fIlabel\fP
71 .RS 4
72 Specify a \fIlabel\fP for the device, to allow \fBswapon\fP(8) by label.
73 .RE
74 .sp
75 \fB\-\-lock\fP[=\fImode\fP]
76 .RS 4
77 Use exclusive BSD lock for device or file it operates. The optional argument \fImode\fP can be \fByes\fP, \fBno\fP (or 1 and 0) or \fBnonblock\fP. If the \fImode\fP argument is omitted, it defaults to \fByes\fP. This option overwrites environment variable \fB$LOCK_BLOCK_DEVICE\fP. The default is not to use any lock at all, but it\(cqs recommended to avoid collisions with \fBsystemd\-udevd\fP(8) or other tools.
78 .RE
79 .sp
80 \fB\-p\fP, \fB\-\-pagesize\fP \fIsize\fP
81 .RS 4
82 Specify the page \fIsize\fP (in bytes) to use. This option is usually unnecessary; \fBmkswap\fP reads the size from the kernel.
83 .RE
84 .sp
85 \fB\-U\fP, \fB\-\-uuid\fP \fIUUID\fP
86 .RS 4
87 Specify the \fIUUID\fP to use. The default is to generate a UUID. The format of the UUID is a series of
88 hex digits separated by hyphens, like this: "c1b9d5a2\-f162\-11cf\-9ece\-0020afc76f16". The UUID parameter
89 may also be one of the following:
90 .sp
91 \fBclear\fP
92 .RS 4
93 clear the filesystem UUID
94 .RE
95 .sp
96 \fBrandom\fP
97 .RS 4
98 generate a new randomly\-generated UUID
99 .RE
100 .sp
101 \fBtime\fP
102 .RS 4
103 generate a new time\-based UUID
104 .RE
105 .RE
106 .sp
107 \fB\-v\fP, \fB\-\-swapversion 1\fP
108 .RS 4
109 Specify the swap\-space version. (This option is currently pointless, as the old \fB\-v 0\fP option has become obsolete and now only \fB\-v 1\fP is supported. The kernel has not supported v0 swap\-space format since 2.5.22 (June 2002). The new version v1 is supported since 2.1.117 (August 1998).)
110 .RE
111 .sp
112 \fB\-\-verbose\fP
113 .RS 4
114 Verbose execution. With this option \fBmkswap\fP will output more details about detected problems during swap area set up.
115 .RE
116 .sp
117 \fB\-h\fP, \fB\-\-help\fP
118 .RS 4
119 Display help text and exit.
120 .RE
121 .sp
122 \fB\-V\fP, \fB\-\-version\fP
123 .RS 4
124 Print version and exit.
125 .RE
126 .SH "ENVIRONMENT"
127 .sp
128 LIBBLKID_DEBUG=all
129 .RS 4
130 enables libblkid debug output.
131 .RE
132 .sp
133 LOCK_BLOCK_DEVICE=<mode>
134 .RS 4
135 use exclusive BSD lock. The mode is "1" or "0". See \fB\-\-lock\fP for more details.
136 .RE
137 .SH "NOTES"
138 .sp
139 The maximum useful size of a swap area depends on the architecture and the kernel version.
140 .sp
141 The maximum number of the pages that is possible to address by swap area header is 4294967295 (32\-bit unsigned int). The remaining space on the swap device is ignored.
142 .sp
143 Presently, Linux allows 32 swap areas. The areas in use can be seen in the file \fI/proc/swaps\fP.
144 .sp
145 \fBmkswap\fP refuses areas smaller than 10 pages.
146 .sp
147 If you don\(cqt know the page size that your machine uses, you can look it up with \fBgetconf PAGESIZE\fP.
148 .sp
149 To set up a swap file, it is necessary to create that file before initializing it with \fBmkswap\fP, e.g. using a command like
150 .sp
151 .if n .RS 4
152 .nf
153 .fam C
154 # dd if=/dev/zero of=swapfile bs=1MiB count=$((8*1024))
155 .fam
156 .fi
157 .if n .RE
158 .sp
159 to create 8GiB swapfile.
160 .sp
161 Please read notes from \fBswapon\fP(8) about \fBthe swap file use restrictions\fP (holes, preallocation and copy\-on\-write issues).
162 .SH "SEE ALSO"
163 .sp
164 \fBfdisk\fP(8),
165 \fBswapon\fP(8)
166 .SH "REPORTING BUGS"
167 .sp
168 For bug reports, use the issue tracker at \c
169 .URL "https://github.com/util\-linux/util\-linux/issues" "" "."
170 .SH "AVAILABILITY"
171 .sp
172 The \fBmkswap\fP command is part of the util\-linux package which can be downloaded from \c
173 .URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."