checking allocated disk space

34 views
Skip to first unread message

pixel fairy

unread,
Feb 18, 2020, 12:04:19 AM2/18/20
to qubes-users
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?

awokd

unread,
Feb 18, 2020, 3:05:49 AM2/18/20
to qubes...@googlegroups.com
pixel fairy:
> 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?
>
sudo lvs

--
- don't top post
Mailing list etiquette:
- trim quoted reply to only relevant portions
- when possible, copy and paste text instead of screenshots

Ulrich Windl

unread,
Feb 19, 2020, 2:52:46 AM2/19/20
to pixel...@gmail.com, qubes...@googlegroups.com
>>> pixel fairy <pixel...@gmail.com> 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"?

>
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qubes-users/2104823c-c9c1-4fc9-aa9c-090863f
> 09825%40googlegroups.com.




pixel fairy

unread,
Feb 26, 2020, 3:50:09 AM2/26/20
to qubes-users


On Tuesday, February 18, 2020 at 11:52:46 PM UTC-8, Ulrich Windl wrote:
>>> pixel fairy <pixel...@gmail.com> 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))





Reply all
Reply to author
Forward
0 new messages