Bug 228461

Summary: swapinfo(8) is not able to align the columns with longer names of devices
Product: Base System Reporter: Slawomir Wojciech Wojtczak <vermaden>
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed Feedback Timeout    
Severity: Affects Many People CC: bcr
Priority: ---    
Version: 11.1-STABLE   
Hardware: Any   
OS: Any   

Description Slawomir Wojciech Wojtczak 2018-05-24 14:28:31 UTC
It is now:

% swapinfo -h
Device          1K-blocks     Used    Avail Capacity
/dev/zvol/local/SWAP   4194304      12M     4.0G     0%

% swapinfo -m            
Device          1M-blocks     Used    Avail Capacity
/dev/zvol/local/SWAP      4096       11     4084     0%



Should be:

% swapinfo -h
Device                1K-blocks  Used  Avail  Capacity
/dev/zvol/local/SWAP    4194304   12M   4.0G        0%

% swapinfo -m            
Device                1M-blocks  Used  Avail  Capacity
/dev/zvol/local/SWAP       4096    11   4084        0%
Comment 1 Slawomir Wojciech Wojtczak 2019-10-14 13:12:07 UTC
Should I close that or leave it as it is?
Comment 2 Benedict Reuschling freebsd_committer freebsd_triage 2019-11-12 18:40:21 UTC
It is definitely valid, especially when you have your swap on zvols and/or GELI encrypted swap. This easily overflows the space. Another misalignment happens when you have multiple swap providers, like a swap file or a swap area on each of many disks like this: 

$ swapinfo -h
Device          1K-blocks     Used    Avail Capacity
/dev/gpt/swap0.eli  16777216       0B      16G     0%
/dev/gpt/swap1.eli  16777216       0B      16G     0%
/dev/gpt/swap2.eli  16777216       0B      16G     0%
/dev/gpt/swap3.eli  16777216       0B      16G     0%
Total            67108864       0B      64G     0%

There is a patch in this PR here that might provide a solution:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=223876