Skip to content

Instantly share code, notes, and snippets.

View dlangille's full-sized avatar

Dan Langille dlangille

View GitHub Profile
@dlangille
dlangille / dry run
Last active October 9, 2020 10:03
Doing a dry run of zfs destroy, and seeing what will be destroyed and how much space will be reclaimed
$ zfs destroy -nv system/usr/jails@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/pg93@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/mysql55@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/pg94@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/empty@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/toiler@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/pg90@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/ansible@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/snapshots@BeforeUpgradingBaseJailFrom9.1To9.3
would destroy system/usr/jails/ansible-slave@BeforeUpgradingBaseJailFrom9.1To9.3
@dlangille
dlangille / wget
Created April 12, 2015 01:03
T-mobile tethering not working in Canada
$ wget -S http://www.google.com/
--2015-04-11 15:40:52-- http://www.google.com/
Resolving www.google.com (www.google.com)... 64.233.168.147, 64.233.168.106, 64.233.168.104, ...
Connecting to www.google.com (www.google.com)|64.233.168.147|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 302 Found
Location: http://t-mo.co/IntSMH
Content-Type: text/html; charset=iso-8859-1
Proxy-Connection: close
Location: http://t-mo.co/IntSMH [following]
[dan@knew:~] $ zfs list
NAME USED AVAIL REFER MOUNTPOINT
system 16.6T 3.67T 329K /
system/backups-by-snapshot 10.2G 3.67T 384K /usr/home/ansel/snapshots
system/backups-by-snapshot/mailjail 10.2G 3.67T 9.46G /usr/home/ansel/snapshots/mailjail
system/backups-by-snapshot/mounted 329K 3.67T 329K /usr/home/ansel/snapshots/mounted
system/backups-by-snapshot/testing 329K 3.67T 329K /usr/home/ansel/snapshots/testing
system/root 1.76M 3.67T 567K /root
system/rootfs 4.54G 3.67T 3.01G legacy
system/tmp 7.78G 3.67T 7.69G /tmp
This says 2.6TB used, but only 416GB referred. My conclusion: I could free up 416G
by removing the snapshots.
$ zfs list -r -t all -o name,used,refer,written system/usr/jails/dbclone.backups
NAME USED REFER WRITTEN
system/usr/jails/dbclone.backups 2.61T 416G 0
system/usr/jails/dbclone.backups@2015-02-01_06.21.00--3m 0 389G 389G
system/usr/jails/dbclone.backups@2015-02-01_07.21.00--3m 0 389G 0
system/usr/jails/dbclone.backups@2015-02-01_08.21.00--3m 0 389G 0
system/usr/jails/dbclone.backups@2015-02-01_09.21.00--3m 0 389G 0
Based on this:
$ zfs get usedbysnapshots system/usr/local/bacula
NAME PROPERTY VALUE SOURCE
system/usr/local/bacula usedbysnapshots 3.26T -
... removing all snapshots should free up 3.26T.
But looking below, I found it difficult to see that.
@dlangille
dlangille / diff
Created May 2, 2015 21:13
Changing bacula client from being backed up over VPN to being backed up over internet
$ diff -uN $D/client-zuul.conf client-zuul.conf
+++ /.zfs/snapshot/2015-05-01_05.21.00--3m/usr/local/etc/bacula/client-zuul.conf 2015-03-04 20:03:11.271133766 +0000
--- client-zuul.conf 2015-05-02 19:57:35.949442304 +0000
@@ -1,13 +1,11 @@
# Client (File Services) to backup
Client {
Name = zuul-fd
+ Address = zuul.example.org
- Address = zuul.vpn.example.org
FDPort = 9102
[dan@slocum:/usr/jails] $ sudo du -ch -d 1 .
38G ./bacula
3.5G ./bacula156
94G ./metrics
3.5G ./bacula164
3.5G ./bacula163
3.5G ./bacula169
3.5G ./bacula151
3.4G ./minion
3.5G ./bacula170
+---------------------+---------------------+------------+--------------+
| Connected (UTC) | Disconnected (UTC) | Connected | Disconnected |
|---------------------+---------------------+------------+--------------+
| 2015-03-25 05:35:34 | 2015-05-02 21:27:47 | 1d 21:27 | 0d 00:00 |
| 2015-05-02 21:39:29 | 2015-05-21 08:16:32 | 18d 10:37 | 0d 00:11 |
| 2015-05-21 08:19:14 | 2015-05-21 08:40:57 | 0d 00:21 | 0d 00:02 |
| 2015-05-21 08:43:22 | Still up | 10d 15:16 | 0d 00:02 |
+---------------------+---------------------+------------+--------------+
bsdcan=# \d person
Table "public.person"
Column | Type | Modifiers
-----------------+-----------------------------+-------------------------------------------------------------
id | integer | not null default nextval('person_id_seq'::regclass)
date_added | timestamp without time zone | not null default ('now'::text)::timestamp(6) with time zone
first_name | text | not null
last_name | text | not null
@dlangille
dlangille / TEMPer
Created June 10, 2015 01:04
The USB thermal sensor when inserted into Raspberry PI 2 running FreeBSD 11.x
[root@dvl ~]#
ugen0.5: <RDing> at usbus0
ukbd0: <RDing TEMPerV1.4, class 0/0, rev 2.00/0.01, addr 5> on usbus0
kbd1 at ukbd0
ums0: <RDing TEMPerV1.4, class 0/0, rev 2.00/0.01, addr 5> on usbus0