6 .Nd manage bcachefs filesystems/devices
15 utility supports the following subcommands,
16 which are documented in detail below:
17 .Ss Superblock commands
18 .Bl -tag -width 18n -compact
20 Format one or a list of devices with bcachefs data structures.
22 Dump superblock information to stdout.
24 Set a filesystem option
27 .Bl -tag -width 18n -compact
32 .Bl -tag -width 18n -compact
34 Check an existing filesystem for errors.
36 .Ss Commands for managing a running filesystem
37 .Bl -tag -width 18n -compact
41 .Ss Commands for managing devices within a running filesystem
42 .Bl -tag -width 22n -compact
44 Add a new device to an existing filesystem
46 Remove a device from an existing filesystem
48 Re-add an existing member to a filesystem
50 Take a device offline, without removing it
51 .It Ic device evacuate
52 Migrate data off of a specific device
53 .It Ic device set-state
54 Mark a device as failed
56 Resize filesystem on a device
57 .It Ic device resize-journal
58 Resize journal on a device
60 .Ss Commands for managing subvolumes and snapshots
61 .Bl -tag -width 18n -compact
62 .It Ic subvolume create
63 Create a new subvolume
64 .It Ic subvolume delete
65 Delete an existing subvolume
66 .It Ic subvolume snapshot
69 .Ss Commands for managing filesystem data
70 .Bl -tag -width 18n -compact
71 .It Ic data rereplicate
72 Rereplicate degraded data
74 Kick off low level data jobs
76 .Ss Commands for encryption
77 .Bl -tag -width 18n -compact
79 Unlock an encrypted filesystem prior to running/mounting
81 Change passphrase on an existing (unmounted) filesystem
82 .It Ic remove-passphrase
83 Remove passphrase on an existing (unmounted) filesystem
85 .Ss Commands for migration
86 .Bl -tag -width 18n -compact
88 Migrate an existing filesystem to bcachefs, in place
89 .It Ic migrate-superblock
90 Add default superblock, after bcachefs migrate
92 .Ss Commands for operating on files in a bcachefs filesystem
93 .Bl -tag -width 18n -compact
95 Set various per file attributes
97 .Ss Commands for debugging
98 .Bl -tag -width 18n -compact
100 Dump filesystem metadata to a qcow2 image
102 List filesystem metadata in textual form
104 List contents of journal
107 .Bl -tag -width 18n -compact
108 .It Ic fusemount Mount a filesystem via FUSE
110 .Ss Miscellaneous commands
111 .Bl -tag -width 18n -compact
113 Display the version of the invoked bcachefs tool
115 Generate shell completions
117 .Sh Superblock commands
119 .It Nm Ic format Oo Ar options Oc Ar devices\ ...
120 Format one or a list of devices with bcachefs data structures.
121 You need to do this before you create a volume.
123 Device specific options must come before corresponding devices, e.g.
124 .Dl bcachefs format --label=ssd /dev/sda --label=hdd /dev/sdb
126 .It Fl -block_size Ns = Ns Ar size
127 block size, in bytes (e.g. 4k)
128 .It Fl -btree_node_size Ns = Ns Ar size
129 Btree node size, default 256k
130 .It Fl -errors Ns = Ns ( Cm continue | ro | panic )
131 Action to take on filesystem error
132 .It Fl -data_replicas Ns = Ns Ar number
133 Number of data replicas
134 .It Fl -metadata_replicas Ns = Ns Ar number
135 Number of metadata replicas
136 .It Fl -data_replicas_required Ns = Ns Ar number
138 .It Fl -metadata_replicas_required Ns = Ns Ar number
140 .It Fl -encoded_extent_max Ns = Ns Ar size
141 Maximum size of checksummed/compressed extents
142 .It Fl -metadata_checksum Ns = Ns ( Cm none | crc32c | crc64 | xxhash )
143 Set metadata checksum type (default:
145 .It Fl -data_checksum Ns = Ns ( Cm none | crc32c | crc64 | xxhash )
146 Set data checksum type (default:
148 .It Fl -compression Ns = Ns ( Cm none | lz4 | gzip | zstd )
149 Set compression type (default:
151 .It Fl -background_compression Ns = Ns ( Cm none | lz4 | gzip | zstd )
153 .It Fl -str_hash Ns = Ns ( Cm crc32c | crc64 | siphash )
154 Hash function for directory entries and xattrs
155 .It Fl -metadata_target Ns = Ns Ar target
156 Device or label for metadata writes
157 .It Fl -foreground_target Ns = Ns Ar target
158 Device or label for foreground writes
159 .It Fl -background_target Ns = Ns Ar target
160 Device or label to move data to in the background
161 .It Fl -promote_target Ns = Ns Ar target
162 Device or label to promote data to on read
164 Enable erasure coding (DO NOT USE YET)
166 Constrain inode numbers to 32 bits
167 .It Fl -shared_inode_numbers
168 Shared new inode numbers by CPU id
169 .It Fl -inodes_use_key_cache
170 Use the btree key cache for the inodes btree
171 .It Fl -gc_reserve_percent Ns = Ns Ar percentage
172 Percentage of disk space to reserve for copygc
173 .It Fl -gc_reserve_bytes Ns = Ns Ar percentage
174 Amount of disk space to reserve for copygc
176 This takes precedence over
177 .Cm gc_reserve_percent
179 .It Fl -root_reserve_percent Ns = Ns Ar percentage
180 Percentage of disk space to reserve for superuser
182 Store full 128bits of cryptographic MACS, instead of 80
190 Enable project quotas
191 .It Fl -journal_transaction_names
192 Log transaction function names in journal
194 Nocow mode: Writes will be done in place when possible.
196 Snapshots and reflink will still caused writes to be COW.
198 This flag implicitly disables data checksumming, compression and
200 .It Fl -replicas Ns = Ns Ar number
201 Sets both data and metadata replicas
203 Enable whole filesystem encryption (chacha20/poly1305);
204 passphrase will be prompted for.
205 .It Fl -no_passphrase
206 Don't encrypt master encryption key
207 .It Fl L , Fl -fs_label Ns = Ns Ar label
208 Create the filesystem with the specified
210 .It Fl U , -uuid Ns = Ns Ar uuid
211 Create the filesystem with the specified
213 .It Fl -superblock_size Ns = Ns Ar size
217 Device specific options:
220 Enable discard/TRIM support
221 .It Fl -fs_size Ns = Ns Ar size
222 Create the filesystem using
224 bytes on the subsequent device.
225 .It Fl -bucket Ns = Ns Ar size
226 Specifies the bucket size;
227 must be greater than the btree node size
228 .It Fl -durability Ns = Ns Ar n
229 Data written to this device will be considered
230 to have already been replicated
236 Force the filesystem to be created,
237 even if the device already contains a filesystem.
240 .It Fl v , Fl -verbose
241 Verbose filesystem initialization
243 .It Nm Ic show-super Oo Ar options Oc Ar device
244 Dump superblock information to stdout.
246 .It Fl f , Fl -fields Ns = Ns Ar fields
247 List of sections to print
248 .It Fl l , Fl -layout
249 Print superblock layout
254 .It Nm Ic mount Oo Ar options Oc Ar device mountpoint
255 Mount a filesystem. The
257 can be a device, a colon-separated list of devices, or UUID=<UUID>. The
259 is the path where the filesystem should be mounted. If not set, then the filesystem won't actually be mounted
260 but all steps preceding mounting the filesystem (e.g. asking for passphrase) will still be performed.
261 .Pp the options are as follows:
264 Mount options provided as a comma-separated list. See user guide for complete list.
265 .Bl -tag -width Ds -compact
267 Allow mounting with data degraded
269 Extra debugging info during mount/recovery
271 Run fsck during mount
273 Fix errors without asking during fsck
275 Mount in read only mode
276 .It Cm version_upgrade
278 .It Fl k , Fl -key-location Ns = Ns ( Cm fail | wait | ask )
279 Where the password would be loaded from. (default:
281 .Bl -tag -width Ds -compact
283 don't ask for password, fail if filesystem is encrypted.
285 wait for password to become available before mounting.
287 prompt the user for password.
289 .It Fl c , Fl -colorize Ns = Ns ( Cm true | false )
290 Force color on/off. Default: auto-detect TTY
292 Be verbose. Can be specified more than once.
297 .It Nm Ic fsck Oo Ar options Oc Ar devices\ ...
298 Check an existing filesystem for errors.
301 Automatic repair (no questions)
303 Don't repair, only check for errors
305 Assume "yes" to all questions
307 Force checking even if filesystem is marked clean
308 .It Fl r , Fl -ratelimit_errors
309 Don't display more than 10 errors of a given type
310 .It Fl R , Fl -reconstruct_alloc
311 Reconstruct the alloc btree
316 .Sh Commands for managing a running filesystem
318 .It Nm Ic fs Ic usage Oo Ar options Oc Op Ar filesystem
321 .It Fl h , Fl -human-readable
322 Print human readable sizes.
325 .Sh Commands for managing devices within a running filesystem
327 .It Nm Ic device Ic add Oo Ar options Oc Ar device
328 Add a device to an existing filesystem.
330 .It Fl -fs_size Ns = Ns Ar size
331 Size of filesystem on device
332 .It Fl -bucket Ns = Ns Ar size
336 .It Fl l , Fl -label Ns = Ns Ar label
339 Use device even if it appears to already be formatted
341 .It Nm Ic device Ic remove Oo Ar options Oc Ar device
342 Remove a device from a filesystem
345 Force removal, even if some data couldn't be migrated
346 .It Fl F , Fl -force-metadata
347 Force removal, even if some metadata couldn't be migrated
349 .It Nm Ic device Ic online Ar device
350 Re-add a device to a running filesystem
351 .It Nm Ic device Ic offline Ar device
352 Take a device offline, without removing it
355 Force, if data redundancy will be degraded
357 .It Nm Ic device Ic evacuate Ar device
358 Move data off of a given device
359 .It Nm Ic device Ic set-state Oo Ar options Oc Ar new-state Ar device
361 .It Ar new-state Ns = Ns ( Ar rw | ro | failed | spare )
363 Force, if data redundancy will be degraded
364 .It Fl -force-if-data-lost
365 Force, if data will be lost
366 .It Fl o , Fl -offline
367 Set state of an offline device
369 .It Nm Ic device Ic resize Ar device Op Ar size
370 Resize filesystem on a device
371 .It Nm Ic device Ic resize-journal Ar device Op Ar size
372 Resize journal on a device
374 .Sh Commands for managing subvolumes and snapshots
376 .It Ic subvolume create Oo Ar options Oc Ar path
377 Create a new subvolume
378 .It Ic subvolume delete Oo Ar options Oc Ar path
379 Delete an existing subvolume
380 .It Ic subvolume delete Oo Ar options Oc Ar source dest
388 if not specified the snapshot will be of the subvolume containing
392 Make snapshot read-only
395 .Sh Commands for managing filesystem data
397 .It Nm Ic data Ic rereplicate Ar filesystem
398 Walks existing data in a filesystem,
399 writing additional copies of any degraded data.
400 .It Nm Ic data Ic job Ar job filesystem
401 Kick off a data job and report progress
405 .Cm scrub | rereplicate | migrate | rewrite_old_nodes
410 .It Fl s Ar inode Ns Cm \&: Ns Ar offset
412 .It Fl e Ar inode Ns Cm \&: Ns Ar offset
416 .Sh Commands for encryption
418 .It Nm Ic unlock Ar device
419 Unlock an encrypted filesystem prior to running/mounting.
422 Check if a device is encrypted
423 .It Fl k Ns = Ns ( Cm session | user | user_session )
424 Keyring to add to (default:
427 .It Nm Ic set-passphrase Ar devices\ ...
428 Change passphrase on an existing (unmounted) filesystem.
429 .It Nm Ic remove-passphrase Ar devices\ ...
430 Remove passphrase on an existing (unmounted) filesystem.
432 .Sh Commands for migration
434 .It Nm Ic migrate Oo Ar options Oc Ar device
435 Migrate an existing filesystem to bcachefs
438 Root of filesystem to migrate
440 Enable whole filesystem encryption (chacha20/poly1305)
441 .It Fl -no_passphrase
442 Don't encrypt master encryption key
444 Force, even if metadata file already exists
446 .It Nm Ic migrate-superblock Oo Ar options Oc Ar device
447 Create default superblock after migrating
450 Device to create superblock for
452 Offset of existing superblock
455 .Sh Commands for operating on files in a bcachefs filesystem
457 .It Nm Ic setattr Oo Ar options Oc Ar devices\ ...
459 .It Fl -data_replicas Ns = Ns Ar number
460 Number of data replicas
461 .It Fl -data_checksum Ns = Ns ( Cm none | crc32c | crc64 | xxhash )
462 Set data checksum type (default:
464 .It Fl -compression Ns = Ns ( Cm none | lz4 | gzip | zstd )
465 Set compression type (default:
467 .It Fl -background_compression Ns = Ns ( Cm none | lz4 | gzip | zstd )
469 .It Fl -metadata_target Ns = Ns Ar target
470 Device or label for metadata writes
471 .It Fl -foreground_target Ns = Ns Ar target
472 Device or label for foreground writes
473 .It Fl -background_target Ns = Ns Ar target
474 Device or label to move data to in the background
475 .It Fl -promote_target Ns = Ns Ar target
476 Device or label to promote data to on read
478 Enable erasure coding (DO NOT USE YET)
482 Nocow mode: Writes will be done in place when possible.
485 .Sh Commands for debugging
486 These commands work on offline, unmounted filesystems.
488 .It Nm Ic dump Oo Ar options Oc Ar device
489 Dump filesystem metadata
492 Required flag: Output qcow2 image(s)
494 Force; overwrite when needed
496 Don't dump entire journal, just dirty entries
498 .It Nm Ic list Oo Ar options Oc Ar devices\ ...
499 List filesystem metadata to stdout
501 .It Fl b ( Cm extents | inodes | dirents | xattrs )
502 Btree to list from. (default:
505 Btree depth to descend to. (
509 .It Fl s Ar inode Ns Cm \&: Ns Ar offset
510 Start position to list from
511 .It Fl e Ar inode Ns Cm \&: Ns Ar offset
513 .It Fl m , Fl -mode ( Cm keys | formats | nodes | nodes-ondisk )
517 Check (fsck) the filesystem first
518 .It Fl c , Fl -colorize Ns = Ns ( Cm true | false )
519 Force color on/off. Default: auto-detect TTY
523 .It Nm Ic list_journal Oo Ar options Oc Ar devices\ ...
526 Read entire journal, not just dirty entries
527 .It Fl n , Fl -nr-entries Ns = Ns Ar nr
528 Number of journal entries to print, starting from the most recent
529 .It Fl t , Fl -transaction-filter Ns = Ns Ar bbpos
530 Filter transactions not updating
532 .It Fl k , Fl -key-filter Ns = Ns Ar btree
533 Filter keys not updating
535 .It Fl v , Fl -verbose
542 Mount a filesystem via FUSE
544 .Sh Miscellaneous commands
546 .It Nm Ic completions Ar shell
547 Generate shell completions
549 Display the version of the invoked bcachefs tool