Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

[PROBLEM] BTRFS snapshots. Exclude paths
Thank you for your donation

Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Problem: BTRFS snapshots. Exclude paths
10th Sep, 2014, 03:02 AM
Post: #1
xbfgf Offline
Registered
Posts: 13
Joined: Sep 2014
Reputation: 0
BTRFS snapshots. Exclude paths
Running into a full filesystem often as I'm downloading files straight to my SD on a Raspberry.

Traced it to the regular snapshots running from cron.daily and cron.weekly, which keep a snapshot copy of the files even after they are deleted or moved. Deleting or moving the files doesn't free up space in that case.

Any ideas on how to exclude specific paths from the btrfs-auto-snapshot?
Is it a better idea to create a new btrfs subvolume, point all downloads there, and then change the cron entries to be specific (rather than the current //) and not include that new subvolume?
Find all posts by this user
Quote this message in a reply
21st Sep, 2014, 03:29 AM
Post: #2
CurlyMo Offline
Registered
Posts: 3,501
Joined: Dec 2012
Reputation: 202
Re: BTRFS snapshots. Exclude paths
No, not possible.

pilight - modular domotica solution
Visit this user's website Find all posts by this user
Quote this message in a reply
10th Oct, 2014, 10:40 AM
Post: #3
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: BTRFS snapshots. Exclude paths
@xbfgf

it is as you proposed. in that way btrfs is like zfs. so snapshot operation starts and ends with sub-volume (as target for snapshot operations).

so create new subvolume and change temporarily // to "root home". or just root. it is up you (btrfs-auto-snapshots will take to consideration all listed filesystem - the names needs to be as last parameters).

I will put --exclude parameter to btrfs-auto-snapshot and update the cronntabs to run
Code:
btrfs-auto-snapshot -l daily -k $KEEPDAYS -v --exclude="$EXCLUDESUB" //

where EXCLUDESUB is new parameter in

/etc/default/xbian-snap:
Code:
# exclude those subvolumes by default for btrfs-auto-snapshot operations (put a list of names separated by spaces)
EXCLUDESUB=""

it was always considered as planned feature specially because XBian on its own provides "downloader" package. so once we test & deploy this general changes, downloader package should be updated to create new subvolume and use it as target for the DL programs.

I remember that you are not very first refreshing this problem - but until now all the other users probably migrated to USB HDD installs anyhow (to big disks so they postponed this discussion for few months Wink ).
but sure it needs to be an implemented option. I will ask you bit later for testing the new btrfs-auto-snapshot ...

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
10th Oct, 2014, 06:43 PM
Post: #4
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
RE: BTRFS snapshots. Exclude paths
That sounds excellent mk01, I would like to see an exclude option.

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
10th Oct, 2014, 07:11 PM
Post: #5
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: BTRFS snapshots. Exclude paths
preliminary support in 2.1.11 of -config-shell package. all is as proposed earlier. only the list in default/xbian-snap is comma separated, not space separated

cron jobs updated

and core support at btrfs-auto-snapshot wrapper takes --exclude or -x

it can be easily tested with
Code:
btrfs-auto-snapshot list -x root,home,data //

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
10th Oct, 2014, 07:27 PM
Post: #6
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
RE: BTRFS snapshots. Exclude paths
Is this in staging?

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
10th Oct, 2014, 07:31 PM
Post: #7
mk01 Offline
Registered
Posts: 2,485
Joined: Mar 2013
Reputation: 209
RE: BTRFS snapshots. Exclude paths
as it was not changing existing code I put directly to stable

Please read rules and do a search before you post! . FAQs . How to post log file? . Looking for answers? Please start here
Find all posts by this user
Quote this message in a reply
10th Oct, 2014, 07:35 PM
Post: #8
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
RE: BTRFS snapshots. Exclude paths
Okay, thanks a lot mk01. I will test it out later and report any issues here.

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
23rd Feb, 2015, 09:12 AM
Post: #9
xbfgf Offline
Registered
Posts: 13
Joined: Sep 2014
Reputation: 0
RE: BTRFS snapshots. Exclude paths
Seemed to be working fine for me (I configured the exclusion of "/media"), until I had an unrelated issue and had to rollback to a previous "root" snapshot. I was not expecting that by doing it I would lose everything under /media.

I now list snapshots and find this one:
root/@btrfs-auto-snap_apt-run-2015-02-21-1837_rollback/media
which I was hoping could get me /media back, but it comes back with:

btrfs-auto-snapshot rollback root/@btrfs-auto-snap_apt-run-2015-02-21-1837_rollback/media
Error: Source name does not exists!


Any ideas?
Find all posts by this user
Quote this message in a reply
24th Feb, 2015, 10:06 PM
Post: #10
f1vefour Offline
Administrator
******
Posts: 1,342
Joined: Mar 2013
Reputation: 58
RE: BTRFS snapshots. Exclude paths
If you still are running xbian what does this show:

Terminal
btrfs subvolume list '/'

Please read rules and do a search before you post! | FAQs | How to post log file? | Can't find an answer? Contact us.
Visit this user's website Find all posts by this user
Quote this message in a reply
25th Feb, 2015, 07:26 PM
Post: #11
xbfgf Offline
Registered
Posts: 13
Joined: Sep 2014
Reputation: 0
RE: BTRFS snapshots. Exclude paths
Media was a subvolume. After restoring "root" snapshot, "/media" was still there, but empty and I was unable to do anything inside it (even a touch as root came back with permission denied).
I therefore ended up deleting the subvolume (which did work) and recreating it.

I guess that kind of invalidates the results now, but here goes:
(Note I'd taken a couple of the snapshots myself manually)

root@xbian ~ # btrfs subvolume list '/'
ID 257 gen 26534 top level 5 path root
ID 258 gen 25407 top level 257 path root/@btrfs-auto-snap_apt-run-2015-02-21-1837_rollback
ID 259 gen 26531 top level 5 path modules
ID 260 gen 26529 top level 259 path modules/@
ID 261 gen 26528 top level 5 path home
ID 262 gen 26560 top level 261 path home/@
ID 266 gen 26525 top level 5 path data
ID 267 gen 26523 top level 266 path data/@
ID 315 gen 25289 top level 258 path root/@btrfs-auto-snap_apt-run-2015-02-21-1837_rollback/media
ID 1050 gen 20777 top level 257 path root/@btrfs-auto-snap_apt-run-2015-02-14-1338
ID 1068 gen 22774 top level 266 path data/@btrfs-auto-snap_weekly-2015-02-16-0919
ID 1070 gen 22777 top level 261 path home/@btrfs-auto-snap_weekly-2015-02-16-0919
ID 1072 gen 22780 top level 259 path modules/@btrfs-auto-snap_weekly-2015-02-16-0919
ID 1074 gen 22783 top level 257 path root/@btrfs-auto-snap_weekly-2015-02-16-0919
ID 1076 gen 22916 top level 257 path root/@btrfs-auto-snap_apt-run-2015-02-16-1556
ID 1118 gen 26556 top level 257 path root/@
ID 1129 gen 25402 top level 258 path root/@btrfs-auto-snap_apt-run-2015-02-21-1837_rollback/root/before_rollback_22_02_2015
ID 1130 gen 25429 top level 1118 path var/log/after_rollback_22_02_2015
ID 1131 gen 25453 top level 266 path data/@btrfs-auto-snap_daily-2015-02-22-1803
ID 1133 gen 25456 top level 261 path home/@btrfs-auto-snap_daily-2015-02-22-1803
ID 1135 gen 25459 top level 259 path modules/@btrfs-auto-snap_daily-2015-02-22-1803
ID 1137 gen 25462 top level 257 path root/@btrfs-auto-snap_daily-2015-02-22-1803
ID 1139 gen 25814 top level 266 path data/@btrfs-auto-snap_daily-2015-02-23-0950
ID 1141 gen 25817 top level 261 path home/@btrfs-auto-snap_daily-2015-02-23-0950
ID 1143 gen 25820 top level 259 path modules/@btrfs-auto-snap_daily-2015-02-23-0950
ID 1145 gen 25823 top level 257 path root/@btrfs-auto-snap_daily-2015-02-23-0950
ID 1147 gen 25827 top level 266 path data/@btrfs-auto-snap_weekly-2015-02-23-0950
ID 1149 gen 25830 top level 261 path home/@btrfs-auto-snap_weekly-2015-02-23-0950
ID 1151 gen 25833 top level 259 path modules/@btrfs-auto-snap_weekly-2015-02-23-0950
ID 1153 gen 25836 top level 257 path root/@btrfs-auto-snap_weekly-2015-02-23-0950
ID 1155 gen 26411 top level 1118 path media
ID 1156 gen 26524 top level 266 path data/@btrfs-auto-snap_daily-2015-02-25-0902
ID 1157 gen 26524 top level 266 path data/@last_good_known
ID 1158 gen 26527 top level 261 path home/@btrfs-auto-snap_daily-2015-02-25-0902
ID 1159 gen 26527 top level 261 path home/@last_good_known
ID 1160 gen 26530 top level 259 path modules/@btrfs-auto-snap_daily-2015-02-25-0902
ID 1161 gen 26530 top level 259 path modules/@last_good_known
ID 1162 gen 26533 top level 257 path root/@btrfs-auto-snap_daily-2015-02-25-0902
ID 1163 gen 26533 top level 257 path root/@last_good_known
Find all posts by this user
Quote this message in a reply
27th Feb, 2015, 10:05 PM
Post: #12
xbfgf Offline
Registered
Posts: 13
Joined: Sep 2014
Reputation: 0
RE: BTRFS snapshots. Exclude paths
Hi, reproduced issue again.

Did a root snapshot rollback.
After that "/media" still showed content.
Rebooted, "/media" is there but has no content and cannot "touch it":

Terminal
root@xbian /media # touch 1
touch: cannot touch `1': Permission denied
root@xbian /media # ls -alrt
total 0
drwxr-xr-x 1 root root 172 Feb 23 17:42 ..
drwxr-xr-x 1 root root 0 Feb 27 13:00 .
Find all posts by this user
Quote this message in a reply
24th Sep, 2015, 02:13 AM
Post: #13
xbfgf Offline
Registered
Posts: 13
Joined: Sep 2014
Reputation: 0
RE: BTRFS snapshots. Exclude paths
Any ideas? Happened once again. Is this just the way it's meant to work?
Find all posts by this user
Quote this message in a reply
24th Sep, 2015, 03:24 AM
Post: #14
CurlyMo Offline
Registered
Posts: 3,501
Joined: Dec 2012
Reputation: 202
RE: BTRFS snapshots. Exclude paths
Yes

pilight - modular domotica solution
Visit this user's website Find all posts by this user
Quote this message in a reply
12th Oct, 2015, 03:52 PM
Post: #15
xbfgf Offline
Registered
Posts: 13
Joined: Sep 2014
Reputation: 0
RE: BTRFS snapshots. Exclude paths
(24th Sep, 2015 03:24 AM)CurlyMo Wrote:  Yes

Ok, now I'm finding that every time I reboot, files inside my /media folder get deleted, except for two files dated back in March. This is different from my previous issue in that the actual "/media" folder remains, but it is practically empty.

Had created it with
Terminal
btrfs subvolume create /media
Any ideas? Might it be restoring some old snapshot on each reboot?
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 9th May, 2025, 04:03 PM Powered By MyBB, © 2002-2025 MyBB Group.