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: 7 × 6
#>   filesystem      blocks_1024     used available capacity mounted_on    
#>   <chr>                 <dbl>    <dbl>     <dbl>    <dbl> <chr>         
#> 1 /dev/root         151263856 63084076  88163396     0.42 /             
#> 2 tmpfs               8183760       84   8183676     0.01 /dev/shm      
#> 3 tmpfs               3273504     1024   3272480     0.01 /run          
#> 4 tmpfs                  5120        0      5120     0    /run/lock     
#> 5 /dev/nvme0n1p16      901520    86444    751948     0.11 /boot         
#> 6 /dev/nvme0n1p15      106832     6250    100582     0.06 /boot/efi     
#> 7 tmpfs               1636752       12   1636740     0.01 /run/user/1001

## All local disks
df <- disk_free(local = TRUE)
print(df)
#> # A tibble: 7 × 6
#>   filesystem      blocks_1024     used available capacity mounted_on    
#>   <chr>                 <dbl>    <dbl>     <dbl>    <dbl> <chr>         
#> 1 /dev/root         151263856 63084080  88163392     0.42 /             
#> 2 tmpfs               8183760       84   8183676     0.01 /dev/shm      
#> 3 tmpfs               3273504     1024   3272480     0.01 /run          
#> 4 tmpfs                  5120        0      5120     0    /run/lock     
#> 5 /dev/nvme0n1p16      901520    86444    751948     0.11 /boot         
#> 6 /dev/nvme0n1p15      106832     6250    100582     0.06 /boot/efi     
#> 7 tmpfs               1636752       12   1636740     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    151263856 63084080  88163392     0.42 /