1
Distribuce / Re:Automatický fsck před připojením oddílu
« kdy: 07. 12. 2022, 23:36:23 »
Děkuji, vyzkouším.
Tato sekce Vám umožňuje zobrazit všechny příspěvky tohoto uživatele. Prosím uvědomte si, že můžete vidět příspěvky pouze z oblastí Vám přístupných.
[Unit]
Description=File System Check on non Root Device
DefaultDependencies=no
Conflicts=shutdown.target
Before=local-fs.target
Wants=systemd-fsckd.socket systemd-fsck-root.service
After=systemd-fsckd.socket systemd-fsck-root.service
[Service]
Type=oneshot
RemainAfterExit=no
ExecStart=/usr/local/scripts/check_non_root_fs
TimeoutSec=0
[Install]
WantedBy=local-fs.target
[20:24] root@medved-kladno:~ # tree /.backup/
/.backup/
├── 2104212220
├── 2104221200
├── 2104231200
├── 2104261200
├── 2104271200
├── 2104281200
├── 2104291200
├── 2104301200
├── 2105011200
├── 2105031200
└── 2105041200
11 directories, 0 files
btrfs subvolume get-default /.backup/2104212220/
ID 5 (FS_TREE)
[20:26] root@medved-kladno:~ # btrfs subvolume show /
@
Name: @
UUID: be804fc7-902d-6249-8f59-def7adbc82b7
Parent UUID: -
Received UUID: -
Creation time: 2021-01-06 01:59:10 +0100
Subvolume ID: 256
Generation: 173849
Gen at creation: 6
Parent ID: 5
Top level ID: 5
Flags: -
Snapshot(s):
@/.backup/2104212220
@/.backup/2104221200
@/.backup/2104231200
@/.backup/2104261200
@/.backup/2104271200
@/.backup/2104281200
@/.backup/2104291200
@/.backup/2104301200
@/.backup/2105011200
@/.backup/2105031200
@/.backup/2105041200
[19:13] root@medved-kladno:~ # ls /.backup/2104221200/test
ls: nelze přistoupit k '/.backup/2104221200/test': Adresář nebo soubor neexistuje
[19:24] root@medved-kladno:~ # echo test > /.backup/2104221200/test
[19:24] root@medved-kladno:~ # cat /.backup/2104221200/test
test
#!/bin/bash
DATE="$(date +%y%m%d%H%M)"
btrfs subvolume snapshot / \
/.backup/${DATE}
touch /.backup/${DATE}
btrfs property set -ts /.backup/${DATE} ro true
find /.backup/ -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec btrfs property set -ts {} ro false \; \
-exec btrfs subvolume delete {} \;
exit
Tohle mi to dělá:[19:12] root@medved-kladno:~ # find /.backup/ -mindepth 1 -maxdepth 1 -type d -mtime +10 -exec btrfs property set -ts {} ro false \; -exec btrfs subvolume delete {} \;
Delete subvolume (no-commit): '/.backup/2104221200'
ERROR: Could not destroy subvolume/snapshot: Read-only file system
Delete subvolume (no-commit): '/.backup/2104231200'
ERROR: Could not destroy subvolume/snapshot: Read-only file system
[19:12] root@medved-kladno:~ # touch /.backup/2104221200
[19:12] root@medved-kladno:~ # rm -rf /.backup/2104221200
rm: nelze odstranit '/.backup/2104221200': Systém souborů je pouze pro čtení
[19:12] root@medved-kladno:~ # stat /.backup/2104221200
Soubor: /.backup/2104221200
Velikost: 0 Bloků: 0 I/O blok: 4096 adresář
Zařízení: 5ch/92d I-uzel: 256 Odkazů: 1
Práva: (0755/drwxr-xr-x) UID: ( 0/ root) GID: ( 0/ root)
Přístup: 2021-05-05 19:12:31.757627999 +0200
Změna obsahu: 2021-05-05 19:12:46.881173966 +0200
Změna i-uzlu: 2021-05-05 19:12:46.881173966 +0200
Vznik: 2021-01-06 01:59:10.554144173 +0100
optimages2.sh Obrázky/
File already processed by jpeg-recompress!
Metadata size is 15kb
smallfry at q=67 (40 - 95): 97.331100
smallfry at q=81 (68 - 95): 99.249321
smallfry at q=88 (82 - 95): 100.479576
smallfry at q=92 (89 - 95): 101.507240
smallfry at q=94 (93 - 95): 102.012131
smallfry at q=95 (95 - 95): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
smallfry at q=95 (95 - 94): 102.358299
Final optimized smallfry at q=95: 102.355392
New size is 58% of original (saved 1891 kb)
Metadata size is 15kb