FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backup-scheduler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yusuf Hamied Department of Chemistry
COs
backup-scheduler
Commits
48485319
Commit
48485319
authored
2 years ago
by
Dr Adam Thorn
Browse files
Options
Downloads
Patches
Plain Diff
Add script to report the space that would be reclaimed by deleting older snapshots
parent
73ad8e1d
No related branches found
Branches containing commit
Tags
0.9-ch108
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ROOT/DEBIAN/control
+1
-1
1 addition, 1 deletion
ROOT/DEBIAN/control
ROOT/usr/local/bin/analyse-snapshot-usage
+36
-0
36 additions, 0 deletions
ROOT/usr/local/bin/analyse-snapshot-usage
with
37 additions
and
1 deletion
ROOT/DEBIAN/control
+
1
−
1
View file @
48485319
...
...
@@ -3,6 +3,6 @@ Priority: optional
Section: otherosfs
Maintainer: Chemistry COs <support@ch.cam.ac.uk>
Architecture: all
Version: 0.9-ch9
5
Version: 0.9-ch9
6
Depends: zfs-dkms, postgresql-13 | postgresql-9.5 | postgresql-9.4 , liblockfile-simple-perl, libdbi-perl, libjson-perl, libzfs-perl-chem, libnet-openssh-perl, libdbd-pg-perl, mbuffer, rsync, nfs-kernel-server, pv, libwww-curl-perl
Description: a backup system using ZFS (repository 'backup-scheduler')
This diff is collapsed.
Click to expand it.
ROOT/usr/local/bin/analyse-snapshot-usage
0 → 100755
+
36
−
0
View file @
48485319
#!/bin/bash
# This script runs "zfs destroy" commands. We explicitly specify "-nv" options,
# and I can't currently think of a way it would go wrong, but there is no reason
# for this script to be run as root and I want to avoid accidents.
if
[
$EUID
-eq
0
]
;
then
echo
"You appear to be running this script as root. Please run it as unprivileged user instead."
exit
1
fi
if
[
$#
-ne
1
]
;
then
echo
usage:
$0
zfsname
echo
echo
Prints out a report of the space that would be reclaimed by successfully
echo
deleting snapshots of a ZFS, from the oldest through to the newest.
fi
ZFS
=
$1
if
!
zfs list
$ZFS
>
/dev/null 2>&1
;
then
echo
could not list
$ZFS
exit
1
fi
OLDEST
=
$(
zfs list
-H
-t
snapshot
-oname
$ZFS
|
head
-n
1 |
cut
-d
'@'
-f
2
)
ALLSNAPS
=
$(
zfs list
-H
-t
snapshot
-oname
$ZFS
|
cut
-d
'@'
-f
2
)
# NB the following two commands give the same output:
# zfs destroy -nv $ZFS@1654118566
# zfs destroy -nv $ZFS@1654118566%1654118566 # i.e. specifying the same snapshot as the start and end of the range
# so we don't need to special-case how we handle ${OLDEST}
for
SNAP
in
$ALLSNAPS
;
do
RECLAIM
=
$(
zfs destroy
-nv
${
ZFS
}
@
${
OLDEST
}
%
${
SNAP
}
|
grep
"would reclaim"
|
awk
'{print $3}'
)
echo
"
$OLDEST
->
$SNAP
:
$RECLAIM
"
done
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment