On Tuesday, February 18, 2020 at 11:52:46 PM UTC-8, Ulrich Windl wrote:
>
> >>> pixel fairy > schrieb am 18.02.2020
> um 06:04 in Nachricht
> <13889_1582002262_5E4B7056_13889_59_1_2104823c-c9c1-4fc9-aa9c-090863f09825@googl
>
>
> groups.com>:
> > trying to see how much space is allocated, not actually used in all the
> > qubes. is there an easy command for this? something like qvm-volume info
> > but for all the qubes?
>
> What about "PFree" in output of "pvs"?
>
>
not what i was looking for either. cant just add up all of lvs because of
different kinds of ephemeral volumes. heres a script to just add up all the
-root (for template) and -private volumes.
#!/usr/bin/env python3
import subprocess
# older python doesnt have capture_output in subprocess.run
output = subprocess.check_output(['sudo','lvs'], universal_newlines=True)
lines = output.split('\n')
allocated = 0.0
for line in lines:
l = line.split()
# headers and the empty line at the end
if len(l) < 3:
continue
name = l[0]
size = l[3]
# we only care about vm- volumes
if name[:2] != "vm":
continue
# we only care about persistent volumes, -root and -private
if name[-5:] != "-root" and name[-8:] != "-private":
continue
# lop of the g at the end. check for G in case lvs output changes
if size[-1] != 'g' and size[-1] != 'G':
print(name,size,"size is not in gigs. rewrite script")
exit(1)
size = float(size[:-1])
allocated += size
print("{:7.2f} {}".format(size,name))
print("{:7.2f} total".format(allocated))
--
You received this message because you are subscribed to the Google Groups
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/qubes-users/a0d6ae2c-388a-43e9-ab4d-8763c81a3ece%40googlegroups.com.