Report on File System Disk Usage

disk_free(mounts = NULL, local = FALSE)

Arguments

mounts

A character vector of disks (mount points) to query. If NULL, all disks are queried.

local

If TRUE, only local disks are queried.

Value

A data.frame (tibble) where each row corresponds to a unique disk.

Details

This function queries df -P (POSIX output format) on the system.

Examples

## All disks
df <- disk_free()
print(df)
#> # A tibble: 9 × 6
#>   filesystem blocks_1024     used available capacity mounted_on               
#>   <chr>            <dbl>    <dbl>     <dbl>    <dbl> <chr>                    
#> 1 /dev/root     75085112 53194588  21874140     0.71 /                        
#> 2 tmpfs          8189412       84   8189328     0.01 /dev/shm                 
#> 3 tmpfs          3275768     1020   3274748     0.01 /run                     
#> 4 tmpfs             5120        0      5120     0    /run/lock                
#> 5 efivarfs        131072       30    131038     0.01 /sys/firmware/efi/efivars
#> 6 /dev/sda16      901520    62792    775600     0.08 /boot                    
#> 7 /dev/sda15      106832     6250    100582     0.06 /boot/efi                
#> 8 /dev/sdb1     76829444  4194336  68686668     0.06 /mnt                     
#> 9 tmpfs          1637880       12   1637868     0.01 /run/user/1001           

## All local disks
df <- disk_free(local = TRUE)
print(df)
#> # A tibble: 9 × 6
#>   filesystem blocks_1024     used available capacity mounted_on               
#>   <chr>            <dbl>    <dbl>     <dbl>    <dbl> <chr>                    
#> 1 /dev/root     75085112 53194592  21874136     0.71 /                        
#> 2 tmpfs          8189412       84   8189328     0.01 /dev/shm                 
#> 3 tmpfs          3275768     1020   3274748     0.01 /run                     
#> 4 tmpfs             5120        0      5120     0    /run/lock                
#> 5 efivarfs        131072       30    131038     0.01 /sys/firmware/efi/efivars
#> 6 /dev/sda16      901520    62792    775600     0.08 /boot                    
#> 7 /dev/sda15      106832     6250    100582     0.06 /boot/efi                
#> 8 /dev/sdb1     76829444  4194336  68686668     0.06 /mnt                     
#> 9 tmpfs          1637880       12   1637868     0.01 /run/user/1001           

## /tmp 
df <- disk_free(c("/tmp"))
print(df)
#> # A tibble: 1 × 6
#>   filesystem blocks_1024     used available capacity mounted_on
#>   <chr>            <dbl>    <dbl>     <dbl>    <dbl> <chr>     
#> 1 /dev/root     75085112 53194592  21874136     0.71 /