Files
cmp-docs/docs/linux/fs-btrfs.md
Super User 2ec594f584 Add ip-veth
2024-12-12 17:08:58 +03:00

50 lines
741 B
Markdown

# Btrfs
### Snapshot
#### Create shapshot
```bash
btrfs subvolume snapshot xyz xyz-snapshot-path-name
# or
btrfs subvolume snapshot main "main-`date +%Y-%m-%d`"
```
#### Delete shapshot
```bash
btrfs subvolume delete xyz-snapshot-path-name
# or
btrfs subvolume delete "`echo main-* | tr ' ' \\\\n | sort | head -n 1`"
```
### Common
#### Resize
```bash
btrfs filesystem resize max /mnt/dmp/
# or for view ID
btrfs device usage /mnt/dmp/
btrfs filesystem resize ID:max /mnt/dmp/
```
#### Defragment / compress
```bash
mount -o compress=zstd:15 -t /dev/sdx /mnt
# or
btrfs filesystem defragment -v -clzo /boot/*
# or
chattr +c dir
```
#### Set RO / RW
```bash
btrfs property set -f . ro false
btrfs property set -f . ro true
```