Physical disk layout
Explanation
This shows the on-disk format of a BTRFS file system on the most zoomed-out level. BTRFS includes a device mapper functionality where a single logical file system can be spread over multiple physical disks, and a logical block can have multiple copies of it stored on disk. Here we assume the file system has only one physical disk and there are no RAID features enabled.
This page shows the layout of the phyiscal disk. It is organized in "chunks", typically a few megabytes to a gigabyte in size, with possibly some unassigned space in between. There are three types of chunks:
- Data: A data chunk contains actual contents of files. The contents of one file do not have to be stored in the data chunk in a contiguous way, and can be spread out over multiple data chunks. The data chunk itself also contains no information about which files the data belongs to, all of that is stored in the metadata. Very small files (e.g. under 1 KiB) do not have their contents in here, but they are entirely stored in the metadata section.
- Metadata: This contains all information about file names, directories, checksums, used and free space, devices etc. The data here is organized in the eponymous "B-Trees", which is essentially a type of key-value store. Click on a metadata chunk to find out what is stored inside it.
- System: The system chunks are just additional metadata chunks, except that they are reserved for special kinds of metadata. Most importantly, the system chunks contain the mapping from logical to physical addresses, which is needed to find the other metadata chunks. The physical locations of the system chunks are stored in the superblock, thereby avoiding a chicken-and-egg problem while mounting the drive.
The first column in the following table shows the physical address of a chunk and the second column shows its logical address. You can click on the metadata or system chunks to find out how they are laid out.
0unassigned, 13 MiB
d00000d00000data chunk, 8 MiB
2250000011d00000data chunk, 320 MiB
3650000025d00000data chunk, 320 MiB
4a50000039d00000data chunk, 320 MiB
5e5000004dd00000data chunk, 320 MiB
7250000061d00000data chunk, 320 MiB
8650000075d00000data chunk, 320 MiB