ÇÒ´çµÈ µð½ºÅ© Å©±â¸¸ º¸¿©Áö´Â°Ô ¾Æ´Ï¶ó ½ÇÁ¦ VM¿¡¼ »ç¿ëÇÏ°í ÀÖ´Â ³»¿ëÀ» ½Ç½Ã°£À¸·Î ¹Ý¿µÇÏ¿© ³ªÅ¸³½´Ù.
"virt-df" is a command line tool to display free space on virtual machine filesystems.
Unlike other tools, it doesn't just display the size of disk allocated to a virtual machine, but can look inside disk images to see how much space is really being used.
If used without any -a or -d arguments, "virt-df" checks with libvirt to get a list of all active and inactive guests, and performs a "df"-type operation on each one in turn, printing out the results.
If any -a or -d arguments are specified, "virt-df" performs a "df"-type operation on either the single named libvirt domain, or on the disk image(s) listed on the command line (which must all belong to a single VM). In this mode (with arguments), "virt-df" will only work for a single guest. If you want to run on multiple guests, then you have to invoke "virt-df" multiple times.
Use the --csv option to get a format which can be easily parsed by other programs. Other options are similar to the standard df(1) command.
Usage:
virt-df [--options] -d domname
virt-df [--options] -a disk.img [-a disk.img ...]
Options:
-a|--add image Add image
-c|--connect uri Specify libvirt URI for -d option
--csv Output as Comma-Separated Values
-d|--domain guest Add disks from libvirt guest
--format[=raw|..] Force disk format for -a option
-h|--human-readable Human-readable sizes in --long output
--help Display brief help
-i|--inodes Display inodes
--one-per-guest Separate appliance per guest
-P nr_threads Use at most nr_threads
--uuid Add UUIDs to --long output
-v|--verbose Verbose messages
-V|--version Display version and exit
-x Trace libguestfs API calls
# apt install libguestfs-tool
# virt-df <IMAGE_FILE>
Filesystem 1K-blocks Used Available Use%
disk:/dev/sda1 25226960 1927552 23283024 8%
disk:/dev/sda15 0 0 0 4%
# virt-df -a <<IMAGE_FILE1> -a <IMAGE_FILE2>
Filesystem 1K-blocks Used Available Use%
disk+:/dev/sda1 25226960 2879440 22331136 12%
disk+:/dev/sda15 0 0 0 4%
disk+:/dev/sdb1 25226960 1653884 23556692 7%
disk+:/dev/sdb15 0 0 0 4%
# virt-df <IMAGE_FILE> -h
Filesystem Size Used Available Use%
disk:/dev/sda1 24G 2.7G 21G 12%
disk:/dev/sda15 104M 3.3M 101M 4%
# virt-filesystems --long --blkdevs --parts -h -a disk
Name Type MBR Size Parent
/dev/sda1 partition - 25G /dev/sda
/dev/sda14 partition - 4.0M /dev/sda
/dev/sda15 partition - 106M /dev/sda
/dev/sda device - 25G -