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