1fssnap_ufs(1M) System Administration Commands fssnap_ufs(1M)
2
3
4
6 fssnap_ufs - create a temporary snapshot of a UFS file system
7
9 fssnap [-F ufs] [-V] -o backing-store=path,
10 [specific-options] /mount/point
11
12
13 fssnap -d [-F ufs] [-V] /mount/point | dev
14
15
16 fssnap -i [-F ufs] [-V] [-o specific-options] /mount/point | dev
17
18
20 The fssnap command queries, creates, or deletes a temporary snapshot of
21 a UFS file system. A snapshot is a point-in-time image of a file system
22 that provides a stable and unchanging device interface for backups.
23
24
25 When creating a file system snapshot, you must specify the file system
26 to be captured and the backing-store file. The backing-store file(s)
27 are where the snapshot subsystem saves old file system data before it
28 is overwritten. Beyond the first backing-store file, fssnap automati‐
29 cally creates additional backing-store files on an as-needed basis.
30
31
32 The number and size of the backing store files varies with the amount
33 of activity in the file system. The destination path must have enough
34 free space to hold the backing-store file(s). This location must be
35 different from the file system that is being captured in a snapshot.
36 The backing-store file(s) can reside on any type of file system,
37 including another UFS file system or an NFS-mounted file system.
38
40 The following options are supported:
41
42 -d
43
44 Deletes the snapshot associated with the given file system.
45
46
47 -i
48
49 Displays the state of one or all UFS snapshots. If a mount-point or
50 device is not specified, a list of all snapshots on the system is
51 displayed. When a mount-point or device is specified, detailed
52 information is provided for the specified file system snapshot by
53 default.
54
55 Use the -o options with the -i option to specify what snapshot
56 information is displayed. Since this feature is provided primarily
57 for use in scripts and on the command line, no labels are displayed
58 for the data. Sizes are all in bytes, and the output is not inter‐
59 nationalized or localized. The information is displayed on one line
60 per option. Unrecognized options display a single ? on the line.
61 One line per option guarantees that there are the same number of
62 lines as options specified and there is a one-to-one correspondence
63 between an output line and an option.
64
65 The following -o options display specific information for a given
66 snapshot. See the EXAMPLES section for examples of how to use these
67 options.
68
69 snapnumber
70
71 Display the snapshot number.
72
73
74 blockdevname
75
76 Display the block device path.
77
78
79 rawdevname
80
81 Display the raw device path.
82
83
84 mountpoint
85
86 Display the mount point of the master file system.
87
88
89 state
90
91 Display the state of the snapshot device.
92
93
94 backing-store
95
96 Display the location of the first backing-store file for this
97 snapshot. If there are multiple backing-store files, subsequent
98 files have the same name as the first file, with the suffixes
99 .2, .3, and so forth.
100
101
102 backing-store-len
103
104 Display the sum of the sizes of the backing-store files.
105
106
107 maxsize
108
109 Display the maxsize value specified for the backing-store
110 file(s).
111
112
113 createtime
114
115 Display the time that the snapshot was created.
116
117
118 chunksize
119
120 Display the copy-on-write granularity.
121
122
123
124 -o specific-options
125
126 Without -d or -i, the default action is to create a snapshot. Spec‐
127 ify the following options when creating a snapshot. All of these
128 options are discretionary, except for the backing-store file, which
129 is required.
130
131 backing-store=path
132
133 Uses path in the creation of the backing-store file(s). path
134 must not reside on the file system that is being captured in a
135 snapshot and must not be the name of an existing file. If path
136 is a directory, then a backing-store file is created within it
137 using a name that is generated automatically. If path is not a
138 directory and does not already exist, then a backing-store file
139 with that name is created. If more than one backing-store file
140 is required, fssnap creates subsequent files automatically. The
141 second and subsequent files have the same name as the first
142 file, with suffixes of .2, .3, and so forth.
143
144 This option can be abbreviated as bf=path or bs=path.
145
146
147 unlink
148
149 Unlinks the backing-store file after the snapshot is created.
150 This option specifies that the backing-store file does not need
151 to be removed manually when the snapshot is deleted. This might
152 make administration more difficult since the file is not visi‐
153 ble in the file system. If this option is not specified, the
154 backing-store files should be removed manually after the snap‐
155 shot is deleted.
156
157
158 chunksize=n [k,m,g]
159
160 Uses n for the chunk size. Chunk size is the granularity of the
161 data that is sent to the backing store.
162
163 Specify chunksize in the following units: k for kilobytes, m
164 for megabytes, or g for gigabytes. By default, chunk size is
165 four times the block size of the file system (typically 32k).
166
167
168 maxsize=n[k,m,g]
169
170 Does not allow the sum of the sizes of the backing-store
171 file(s) to exceed n, where n is the unit specified. The snap‐
172 shot is deleted automatically when the sum of the sizes of the
173 backing-store file(s) exceeds maxsize.
174
175 Specify maxsize in the following units: k for kilobytes, m for
176 megabytes, or g for gigabytes.
177
178
179 raw
180
181 Displays to standard output the name of the raw device instead
182 of the block device when a snapshot is created. The block
183 device is printed by default (when raw is not specified). This
184 option makes it easier to embed fssnap commands in the command
185 line for commands that require the raw device instead. Both
186 devices are always created. This option affects only the out‐
187 put.
188
189
190
192 The following operands are supported:
193
194 mount-point
195
196 The directory where the file system resides.
197
198
199 special
200
201 The physical device for the file system, such as /dev/dsk/c0t0d0s7.
202
203
205 Example 1 Creating a Snapshot of a File System
206
207
208 The following example creates a snapshot of a file system. The block
209 special device created for the snapshot is /dev/fssnap/0.
210
211
212 # fssnap -F ufs -o backing-store=/var/tmp /export/home
213 /dev/fssnap/0
214
215
216
217 Example 2 Backing Up a File System Snapshot Without Having To Unmount
218 the File System
219
220
221 The following example backs up a file system snapshot without having to
222 unmount the file system. Since ufsdump requires the path to a raw
223 device, the raw option is used. The /export/home file system snapshot
224 is removed in the second command.
225
226
227 # ufsdump 0uf /dev/rmt/0 `fssnap -F ufs
228 -o raw,bs=/export/snap /export/home`
229 <output from ufsdump>
230 # fssnap -F ufs -d /export/home
231
232
233
234 Example 3 Backing Up a File System
235
236
237 When backing up a file system, do not let the backing-store file(s)
238 exceed 400 Mbytes. The second command removes the /export/home file
239 system snapshot.
240
241
242 # ufsdump 0uf /dev/rmt/0 `fssnap -F ufs
243 -o maxsize=400m,backing-store=/export/snap,raw
244 /export/home`
245 # fssnap -F ufs -d /export/home
246
247
248
249 Example 4 Performing an Incremental Dump of a Snapshot
250
251
252 The following example uses ufsdump to back up a snapshot of /var. Note
253 the use of the N option to ufsdump, which writes the name of the device
254 being dumped, rather than the name of the snapshot device, to
255 /etc/dumpdates file. See ufsdump(1M) for details on the N flag.
256
257
258 # ufsdump lfNu /dev/rmt/0 /dev/rdsk/c0t3d0s2 `fssnap -F ufs
259 -o raw,bs=/export/scratch,unlink /var`
260
261
262
263 Example 5 Finding Out What Snapshots Currently Exist
264
265
266 The following command displays the currently existing snapshots.
267
268
269 # fssnap -i
270 0 /src
271 1 /export/home
272 <output continues>
273
274
275
276 Example 6 Mounting a File System Snapshot
277
278
279 The following example creates a file system snapshot. After you create
280 a file system snapshot, mount it on /tmp/mount for temporary read-only
281 access.
282
283
284 # fssnap -F ufs -o backing-store=/nfs/server/scratch /export/home
285 /dev/fssnap/1
286 # mkdir /tmp/mount
287 # mount -F ufs -o ro /dev/fssnap/1 /tmp/mount
288
289
290
291 Example 7 Creating a File System Snapshot and Unlinking the Backing-
292 store File
293
294
295 The following example creates a file system snapshot and unlinks the
296 backing-store file. After creating a file system snapshot and unlinking
297 the backing-store file, check the state of the snapshot.
298
299
300 # fssnap -o bs=/scratch,unlink /src
301 /dev/fssnap/0
302 # fssnap -i /src
303 Snapshot number : 0
304 Block Device : /dev/fssnap/0
305 Raw Device : /dev/rfssnap/0
306 Mount point : /src
307 Device state : active
308 Backing store path : /scratch/snapshot2 <UNLINKED>
309 Backing store size : 192 KB
310 Maximum backing store size : Unlimited
311 Snapshot create time : Sat May 06 10:55:11 2000
312 Copy-on-write granularity : 32 KB
313
314
315
316 Example 8 Displaying the Size and Location of the Backing-store File(s)
317 and the Creation Time for the Snapshot
318
319
320 The following example displays the size of the backing-store file(s) in
321 bytes, the location of the backing store, and the creation time for the
322 snapshot of the /test file system.
323
324
325 # fssnap -i -o backing-store-len,backing-store,createtime /test
326 196608
327 /snapshot2
328 Sat May 6 10:55:11 2000
329
330
331
332
333 Note that if there are multiple backing-store files stored in /snap‐
334 shot2, they will have names of the form file (for the first file),
335 file.1, file.2, and so forth.
336
337
339 The following exit values are returned:
340
341 0
342
343 Successful completion.
344
345
346 >0
347
348 An error occurred.
349
350
352 See attributes(5) for descriptions of the following attributes:
353
354
355
356
357 ┌─────────────────────────────┬─────────────────────────────┐
358 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
359 ├─────────────────────────────┼─────────────────────────────┤
360 │Availability │SUNWcsu │
361 └─────────────────────────────┴─────────────────────────────┘
362
363
364 The script-readable output mode is a stable interface that can be added
365 to, but will not change. All other interfaces are subject to change.
366
368 mlock(3C), attributes(5)
369
370
371 See the ntpd man page, delivered in the SUNWntpu package (not a SunOS
372 man page).
373
375 The fssnap device files should be treated like a regular disk block or
376 character device.
377
378
379 The association between a file system and the snapshot is lost when the
380 snapshot is deleted or the system reboots. Snapshot persistence across
381 reboots is not currently supported.
382
383
384 To avoid unnecessary performance impacts, perform the snapshot and sys‐
385 tem backup when the system is least active.
386
387
388 It is not possible to perform a snapshot of a file system if any of
389 the following conditions are true:
390
391 o The file system is in use by system accounting
392
393 o The file system contains a local swap file
394
395 o The file system is used as backing store by an application
396 that uses mlock(3C) to lock its pages. Typically, these are
397 real time applications, such as ntpd (delivered in the SUN‐
398 Wntpu package).
399
400
401 These conditions result in fssnap being unable to write lock the file
402 system prior to performing the snapshot.
403
404
405
406SunOS 5.11 29 Jan 2007 fssnap_ufs(1M)