kdave / btrfsmaintenance

Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected mountpoints or directories.
GNU General Public License v2.0
900 stars 79 forks source link

btrfs-defrag.sh complained about a missing function is_btrfs #52

Closed gridmon closed 5 years ago

gridmon commented 6 years ago

Looks like you have omitted the line to source your common functions.

Can be fixed by editing /usr/share/btrfsmaintenance/btrfs-defrag.sh (or whatever it's path is on your system): And adding this line: . $(dirname $(realpath "$0"))/btrfsmaintenance-functions after line 17 ie current version ie line saying with LOGIDENTIFIER='btrfs-defrag'

Rgds, Andy

sten0 commented 6 years ago

I can confirm this affects 0.4.1. P.S. oh my, I can't believe I missed this too!

barak commented 6 years ago

The debian package, 0.4.1-2, enabled in systemd, does this of course.

$ systemctl status btrfs-defrag.service 
● btrfs-defrag.service - Defragment file data on a mounted filesystem
   Loaded: loaded (/lib/systemd/system/btrfs-defrag.service; static; vendor preset: enabled)
   Active: inactive (dead) since Sat 2018-09-01 00:00:14 IST; 13h ago
     Docs: man:btrfs-filesystem
 Main PID: 25749 (code=exited, status=0/SUCCESS)

Sep 01 00:00:14 tarsk systemd[1]: Started Defragment file data on a mounted filesystem.
Sep 01 00:00:14 tarsk btrfs-defrag.sh[25749]: /usr/share/btrfsmaintenance/btrfs-defrag.sh: 25: /usr/share/btrfsmaintenance/btrfs-defrag.sh: is_btrfs: not found
Sep 01 00:00:14 tarsk btrfs-defrag.sh[25749]: Path / is not btrfs, skipping
Sep 01 00:00:14 tarsk btrfs-defrag.sh[25749]: /usr/share/btrfsmaintenance/btrfs-defrag.sh: 25: /usr/share/btrfsmaintenance/btrfs-defrag.sh: is_btrfs: not found
Sep 01 00:00:14 tarsk btrfs-defrag.sh[25749]: Path /media/barak/BARAK-ARRAY-1 is not btrfs, skipping
sten0 commented 6 years ago

Hi @barak,

I've fixed this in the Debian package at commit:1770406 using #55 and have uploaded 0.4.1-3. It will be a little while before it hits the archive, but a fix is on the way :-)

Cheers, Nicholas

barak commented 6 years ago

Thanks!

obel1x commented 6 years ago

Current openSuse Leap 15.0 is affected too. Did that manually on local machine for testing and it works. I would really love to see this merged to get it updated in repo. Ty, Daniel

kdave commented 5 years ago

I've pushed the first fix from GRMrGecko, though there were several others referenced in the changelog. Sorry fo the delay, 0.4.2 release will come soon.