Hot answers tagged

32 votes
Accepted

What ext4 functionality does btrfs not support?

Disadvantages of btrfs compared to ext4: btrfs doesn't support badblocks This means that if you've run out of spare non-addressable sectors that the HDD firmware keeps to cover for a limited number ...
Tom Hale's user avatar
  • 30k
26 votes
Accepted

btrfs: how to calculate btrfs compression space savings?

In Debian/Ubuntu: apt install btrfs-compsize compsize /mnt/btrfs-partition In Fedora: dnf install compsize compsize /mnt/btrfs-partition output is like this: Processed 123574 files, 1399139 regular ...
AcckiyGerman's user avatar
23 votes
Accepted

nice and ionice: which one should come first?

If nice caused lots of I/O, you would want to do: ionice -c 3 nice ... so that the impact of the I/O would be minimized. Conversely, if ionice performed lots of computation, you would want to do ...
Barmar's user avatar
  • 9,867
21 votes

How to get rid of the “scanning for btrfs file systems” at start-up?

On Ubuntu 18.04 you can uninstall btrfs-support with apt purge btrfs-progs But that probably wouldn't save you much boot time. On my system the reason was, that I don't have a swap partition but on ...
rubo77's user avatar
  • 28.7k
21 votes
Accepted

taking snapshots of a BTRFS volume mounted with nodatacow?

Regarding the nodatacow option, Ohad Rodeh's paper titled BTRFS: The Linux B-tree Filesystem states: It cancels copy-on-write for data blocks, unless there is a snapshot. There is no problem with ...
Emmanuel Rosa's user avatar
19 votes
Accepted

How to duplicate a file without copying its data with btrfs?

There are two options: cp --reflink=always cp --reflink=auto The second is almost always preferable to the first. Using auto means it will fallback to doing a true copy if the file system doesn't ...
eestrada's user avatar
  • 579
17 votes
Accepted

Does it make sense to put btrfs on lvm?

Maybe this explains ( from the btrfs wiki by the way ) A subvolume in btrfs is not the same as an LVM logical volume or a ZFS subvolume. With LVM, a logical volume is a block device in its own right (...
Saint Crusty's user avatar
16 votes

What ext4 functionality does btrfs not support?

As pointed out in the comments there is support for swap files as of kernel 5.0. albeit with some limitations, as listed at https://btrfs.readthedocs.io/en/latest/btrfs-man5.html: SWAPFILE SUPPORT A ...
phk's user avatar
  • 5,933
15 votes
Accepted

Error for `mount`: `system call failed: File exists.`

(I'm not sure why you're using the -o loop mount option, as the LVM snapshot device should be just as good a disk device as its original is.) "File exists" is the standard English text for errno ...
telcoM's user avatar
  • 94.5k
15 votes
Accepted

How do I determine the block size for ext4 and btrfs filesystems?

You'll want to look at the data block allocation size, which is the minimum block that any file can allocate. Large files consist of multiple blocks. And there's always some "waste" at the ...
steve's user avatar
  • 21.9k
15 votes

What is the point of btrfs subvolumes?

I’m no expert—not even close!—but since I’ve been reading a lot about Btrfs lately, and since your question has gone unanswered for six months, I figured I’d give it a shot. Here are two possible use ...
Tim Pederick's user avatar
14 votes

btrfs replace "ERROR: target device smaller than source device"

I encountered this when trying to replace a disk with one slightly smaller. I was getting this error even after resizing the filesystem on the source drive. Since I was using whole disks, there was no ...
rkjnsn's user avatar
  • 662
13 votes

Resize a btrfs partition inside a logical LVM volume

BTRFS takes filesystem mount point as an argument, not a device path. In other words, intead of this: btrfs filesystem resize max /dev/vg/lvhome You should use actual path where the said volume was ...
sanmai's user avatar
  • 1,416
13 votes
Accepted

Can btrfs track / avoid bad blocks?

Sadly, no. btrfs doesn't track bad blocks and btrfs scrub doesn't prevent the next file from hitting the same bad block(s). This btrfs mailing list post suggests to use ext4 with mkfs.ext4 -c (this &...
Tom Hale's user avatar
  • 30k
13 votes
Accepted

How to set a non default zstd compression level at btrfs filesystem defragment?

Kernel 5.1 added ZSTD level support. I tested it with rc1 today using a mount option compress=zstd:12 in /etc/fstab. The default level is 3. To be clear: The change affects only files that are written ...
Sven's user avatar
  • 275
12 votes
Accepted

Serious backup options for linux disk (dmcrypt, luks, ext4, ext3, btrfs) normal and encrypted system

Linux system backup When targeting a true full system backup, disk image backup (as asked) offer substantial advantage (detailed bellow) compared to files based backup. With files based backup disk/...
intika's user avatar
  • 14.3k
12 votes

How do I determine the block size for ext4 and btrfs filesystems?

You could use stat -f to get an answer of any filesystem, eg.: % stat -f /home File: "/home" ID: 5013a37be3cd6a47 Namelen: 255 Type: ext2/ext3 Block size: 4096 Fundamental ...
Matija Nalis's user avatar
  • 3,081
11 votes
Accepted

Why is cp --reflink=auto not the default behaviour?

As of coreutils 9.0 reflink=auto is the default behaviour. See: https://lists.gnu.org/archive/html/info-gnu/2021-09/msg00010.html This is to announce coreutils-9.0, a stable release. This is a new ...
Bruce Adams's user avatar
11 votes

BTRFS convert RAID0 to RAID1

When making a btrfs filesystem across multiple devices, the default is to use RAID0 for data, and RAID1 for metadata. If you want to change this you can pass arguments to the mkfs command to change ...
fooot's user avatar
  • 784
11 votes
Accepted

I have a disk failing in a RAID1 btrfs such that writes are iffy, but reads mostly work. How to replace it?

This has turned out to be a royal PITA. First, it's important to note that btrfs now has a proper replace command, which is very much better than add new, remove failing. First, start by partitioning ...
derobert's user avatar
  • 109k
11 votes

btrfs — Is it dangerous to defragment subvolume which has readonly snapshots?

Btrfs defrag won't break all reflinks Just the particular instances you point it at. So, if you have subvolume A, and snapshots S1 and S2 of that subvolume A, then running defrag on just subvolume A ...
Pro Backup's user avatar
  • 4,894
10 votes
Accepted

How do I view the btrfs checksum of a file?

Btrfs calculates a crc32c checksum for each file. This is not correct. Both of the open-source checksumming file-systems (ZFS and BTRFS) calculate a checksum for each logical block (the unnamed ...
Peter's user avatar
  • 376
10 votes
Accepted

How to verify a file copy is reflink/CoW?

Good question. Looks like there aren't currently any easy high-level ways to tell. One problem is that a file may only share part of the data via Copy-on-Write. This is called a physical extent, and ...
pwaller's user avatar
  • 312
10 votes
Accepted

Btrfs RAID1: How to replace a disk drive that is physically no more there?

Update: According to @mkudlacek, this problem has been fixed. For prosperity, here is my answer to why in 2017, I could not rebuild a RAID with a missing drive. Turns out that this is a limitation of ...
Hans Deragon's user avatar
10 votes

Btrfs RAID1: How to replace a disk drive that is physically no more there?

replace needs the filesystem to be mounted rw to operate. In a degraded BTRFS RAID1 filesytem, you have one and only one chance to mount the filesystem rw using -o degraded: degraded (...
Tom Hale's user avatar
  • 30k
10 votes
Accepted

BTRFS balance completed, but still shows data stored in "single" mode

With the help of a user on the btrfs irc, I was able to answer question (1). It seems unrelated to the reboot and unsuccessful mount attempt (still not sure what that was about). Instead, it seems the ...
mboratko's user avatar
  • 313
10 votes
Accepted

How do I expand btrfs metadata?

TL;DR The metadata (if the btrfs is not suffering general low space condition) will automatically increase. In cases that no unallocated free space exists, the automatic increase is hembered. If, ...
humanityANDpeace's user avatar
10 votes
Accepted

ENOSPC: Why is `btrfs balance` required? What does it do?

Unlike most conventional filesystems, BTRFS uses a two-stage allocator. The first stage allocates large regions of space known as chunks for specific types of data, then the second stage allocates ...
Austin Hemmelgarn's user avatar
10 votes
Accepted

Why would I want to disable Copy-On-Write while creating QEMU Images?

The performance degradation with VM images on BTRFS is not merely due to a lot of file writes; as far as BTRFS is concerned the writes are to the same file. The issue arises from a lot of random ...
Emmanuel Rosa's user avatar
10 votes
Accepted

What does a rmlint's "clone" for btrfs do?

The differences are somewhat subtle. Reflink deletes the duplicate file and creates a new file in its place which is a clone of the original file. The metadata of the duplicate is lost, although ...
thomas_d_j's user avatar
  • 1,501

Only top scored, non community-wiki answers of a minimum length are eligible