Skip to contentSkip to conversation

why does df spin up disks?

DISCUSSION Russell Coker 2 participants 2 messages Jun 29, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

When I have a mounted filesystem why doesn't the kernel store the amount of free space? Why does it need to spin up a disk that had been spun down?

Signature · 2 lines
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/
#1 lore raw
Quoted 2 lines · Russell Coker

When I have a mounted filesystem why doesn't the kernel store the amount of free space? Why does it need to spin up a disk that had been spun down?

Most likely because the inode has been evicted due to memory pressure. I can df my mostly-idle backup disk "most" of the time without it spinning up once it has been mounted & gone to sleep (just did!), but if there's been significant memory movement (or issuing drop_caches) on the box it will spin up again sometimes. This is not unique to btrfs; other filesystems - at least ext4 - do this too, even though they might manage their expiry behaviour differently.

Now, whether the root inode and whatever is required for a df *should* ever expire after mounting or stay pinned, well..you'd have to ask the vfs folks.

-h