Score:0

Free swap file space contained on root partition without rebooting to free space checked by df

om flag

I have created a temporary Swap file (/var/cache/swap/myswap) of 500GB on a Ubuntu worstation at work wiht 1TB RAM. This swapfile is on a BTRFS filesystem.

I don't need anymore of this swapfile now and I would like that space taken by this swapfile doesn't appear anymore when I do a "df" command.

I would like to free this space without rebooting.

I tried : $ swapoff -a

I have also tried : $ swapoff /var/cache/swap/myswap

I have removed too basically the file /var/cache/swap/myswap

But still space 500GB are taken into account when I do a df command (I have still 64% root partition "/" instead of 10% when there is not swapfile of 500GB)

How could I make really this swapfile to not be taken into account with df command without having to reboot ? I mean, that Swapfile removing to be effective.

Nmath avatar
ng flag
Did you `rm` the file?
youpilat13 avatar
om flag
@Nmath . Yes, I removed it as I said but the display of memory with `df` didn't update, that's weird.
Nmath avatar
ng flag
There is likely a cache that prevents it from updating right away. See: https://unix.stackexchange.com/q/8485
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.