# info > BTRFS-CONVERT

---
type: CommandReference
command: btrfs-convert
mode: man
section: 8
source: man-pages
---

## Quick Reference
- `btrfs-convert /dev/sdx` — Convert ext2/3/4 or reiserfs to btrfs in-place.
- `btrfs-convert -r /dev/sdx` — Rollback to original ext2/3/4 if possible (do not run `btrfs balance` before rollback).
- `btrfs-convert --csum sha256 /dev/sdx` — Convert with SHA256 checksum.
- `btrfs-convert -l mylabel /dev/sdx` — Set label during conversion.
- `btrfs-convert -L /dev/sdx` — Copy label from source filesystem.
- `btrfs-convert --uuid copy /dev/sdx` — Copy UUID from source.
- `btrfs-convert -d /dev/sdx` — Disable data checksums (NODATASUM file flag).
- `btrfs-convert -n /dev/sdx` — Disable inlining small files to metadata.
- ***Prerequisite:*** Run `e2fsck -fvy /dev/sdx` (ext2/3/4) or `reiserfsck -fy /dev/sdx` (reiserfs) on source first.
- ***Warning:*** Do not run `btrfs balance` if you plan to rollback. After rollback is no longer needed, optional steps: remove saved subvolume, defrag, and balance.

## Name
btrfs-convert — convert from ext2/3/4 or reiserfs filesystem to btrfs in-place

## Synopsis
`btrfs-convert [options] <device>`

## Options
- `--csum <type>`, `--checksum <type>` — Specify checksum algorithm (crc32c, xxhash, sha256, blake2). Default: crc32c.
- `-d`, `--no-datasum` — Disable data checksums (set NODATASUM file flag).
- `-i`, `--no-xattr` — Ignore xattrs and ACLs.
- `-n`, `--no-inline` — Disable inlining small files to metadata blocks (decreases metadata consumption).
- `-N`, `--nodesize <SIZE>` — Set filesystem nodesize (tree block size). Default: 16KB or page size, whichever larger. Must be multiple of sectorsize, ≤65536. See [mkfs.btrfs(8)](http://localhost/phpMan.php/man/mkfs.btrfs/8/markdown).
- `-r`, `--rollback` — Rollback to original ext2/3/4 if possible.
- `-l`, `--label <LABEL>` — Set filesystem label during conversion.
- `-L`, `--copy-label` — Use label from the converted filesystem.
- `-O`, `--features <feature1>[,<feature2>...]` — Enable filesystem features at conversion. Prefix with `^` to disable. Use `-O list-all` to see available features.
- `-p`, `--progress` — Show progress (on by default).
- `--no-progress` — Disable progress, show only main phases.
- `--uuid <SPEC>` — Set FSID of new filesystem. Options: `new` (default), `copy` (copy from source), or a specific UUID string.

## Examples
### Basic conversion (ext2/3/4)
shell
# Ensure source is clean
e2fsck -fvy /dev/sdx
# Convert
btrfs-convert /dev/sdx
### Conversion with options
shell
# Convert with SHA256 checksum and label
btrfs-convert --csum sha256 -l myfs /dev/sdx
### Rollback after conversion (before balance)
shell
btrfs-convert -r /dev/sdx
### Remove original filesystem metadata (disables rollback)
shell
# Mount the new btrfs first
mount /dev/sdx /mnt
btrfs subvolume delete /mnt/ext2_saved
### Defragment to make file data contiguous (optional, recommended)
shell
btrfs filesystem defrag -v -r -f -t 32M /mnt/
### Balance metadata to make block groups more compact (optional, recommended)
shell
btrfs balance start -m /mnt/
## See Also
- [btrfs-balance(8)](http://localhost/phpMan.php/man/btrfs-balance/8/markdown) — balance btrfs filesystem
- [mkfs.btrfs(8)](http://localhost/phpMan.php/man/mkfs.btrfs/8/markdown) — create a btrfs filesystem

## Exit Codes
- `0` — Success
- `1` — Error