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: 12 × 6
#>    filesystem blocks_1024     used available capacity mounted_on                
#>    <chr>            <dbl>    <dbl>     <dbl>    <dbl> <chr>                     
#>  1 /dev/root    151361008 62093032  89251592     0.42 /                         
#>  2 tmpfs          8183316        0   8183316     0    /dev/shm                  
#>  3 tmpfs          3273328     1036   3272292     0.01 /run                      
#>  4 efivarfs        131072       32    131036     0.01 /sys/firmware/efi/efivars 
#>  5 /dev/sda13     1012140    85552    857828     0.1  /boot                     
#>  6 /dev/sda15      106832     6414    100418     0.07 /boot/efi                 
#>  7 tmpfs          1636660        8   1636652     0.01 /run/user/1001            
#>  8 none              1024        0      1024     0    /run/credentials/getty@tt…
#>  9 none              1024        0      1024     0    /run/credentials/serial-g…
#> 10 none              1024        0      1024     0    /run/credentials/systemd-…
#> 11 none              1024        0      1024     0    /run/credentials/systemd-…
#> 12 none              1024        0      1024     0    /run/credentials/systemd-…

## All local disks
df <- disk_free(local = TRUE)
print(df)
#> # A tibble: 12 × 6
#>    filesystem blocks_1024     used available capacity mounted_on                
#>    <chr>            <dbl>    <dbl>     <dbl>    <dbl> <chr>                     
#>  1 /dev/root    151361008 62093036  89251588     0.42 /                         
#>  2 tmpfs          8183316        0   8183316     0    /dev/shm                  
#>  3 tmpfs          3273328     1036   3272292     0.01 /run                      
#>  4 efivarfs        131072       32    131036     0.01 /sys/firmware/efi/efivars 
#>  5 /dev/sda13     1012140    85552    857828     0.1  /boot                     
#>  6 /dev/sda15      106832     6414    100418     0.07 /boot/efi                 
#>  7 tmpfs          1636660        8   1636652     0.01 /run/user/1001            
#>  8 none              1024        0      1024     0    /run/credentials/getty@tt…
#>  9 none              1024        0      1024     0    /run/credentials/serial-g…
#> 10 none              1024        0      1024     0    /run/credentials/systemd-…
#> 11 none              1024        0      1024     0    /run/credentials/systemd-…
#> 12 none              1024        0      1024     0    /run/credentials/systemd-…

## /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    151361008 62093040  89251584     0.42 /