Some devices are improperly detected on Linux as being rotational (ie: hard-drive with spinning disks) when, in fact, the device is an SSD (flash type) device. mkfs.btrfs
checks:
/sys/block/DEVICE/queue/rotational
where DEVICE
is a block device (sda
, sdb
, etc…) and if the contents of that file is 1
, then mkfs.btrfs
considers that the device is rotational and disables SSD features.
In case mkfs.btrfs
disables SSD features but you are certain that the device is an SSD, you can simply:
echo 0 >/sys/block/DEVICE/queue/rotational
where DEVICE
is the block device, in order to make the kernel treat the device as a non-spinning disk.
After that, you can issue mkfs.btrfs
with your favourite options and mkfs.btrfs
will detect the device as an SSD.
btrfs supports snapshotting at the volume level such that individual files cannot be backed up but rather a snapshot of the entire volume has to be taken. Subvolumes typically exist on the same filesystem as a sub-directory and in order to take a snapshot, a snapshot directory has to first be created using the command line:
btrfs subvolume create /mnt/volume/.snapshots
where:
/mnt/volume
is the path where the btrfs filesystem is mounted,/mnt/volume/.snapshots
is the path where the subvolume will be createdAfter which a snapshot of the volume can be created, for example, by issuing:
btrfs subvolume snapshot -r /mnt/volume /mnt/volume/.snapshots/20250811
where:
-r
stands for read-only,/mnt/volume
is the path where the btrfs filesystem is mounted,/mnt/volume/.snapshots/20250811
is the subdirectory that will store the snapshotSnapshots are instantaneous because btrfs maintains a link between inodes such that the snapshot file represents a careful set of links rather than a complete copy of a file.
Restoring a file does not require any special command but rather copying the file using regular tools should be sufficient. For example to restore /mnt/volume/writeup.docx
from the snapshot folder /mnt/volume/.snapshots/20250811
, simply copying it over is sufficient:
cp /mnt/volume/.snapshots/20250811/writeup.docx /mnt/volume/
To delete the volume-level snapshot after that, issue:
btrfs subvolume delete /mnt/volume/.snapshots/20250811
which should delete the entire folder /mnt/volume/.snapshots/20250811
For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.