Bug 268741 - mkdumprd incorrectly reports remote filesystem space
mkdumprd incorrectly reports remote filesystem space
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: kexec-tools (Show other bugs)
All All
medium Severity medium
: ---
: ---
Assigned To: Cong Wang
Depends On:
  Show dependency treegraph
Reported: 2007-08-30 15:49 EDT by Maarten Broekman
Modified: 2013-09-29 22:08 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2011-04-18 06:41:44 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
command output (1.65 KB, text/plain)
2007-08-30 15:49 EDT, Maarten Broekman
no flags Details
patch to make df output posix compliant in ssh case (1023 bytes, patch)
2007-08-30 16:03 EDT, Neil Horman
no flags Details | Diff
Patch (method 1) (687 bytes, patch)
2007-08-30 16:37 EDT, Maarten Broekman
no flags Details | Diff
Patch (method 2) (908 bytes, patch)
2007-08-30 16:39 EDT, Maarten Broekman
no flags Details | Diff
corrected patch (method 2) (873 bytes, patch)
2007-08-31 08:27 EDT, Maarten Broekman
no flags Details | Diff
unified patch (840 bytes, patch)
2007-08-31 08:29 EDT, Maarten Broekman
no flags Details | Diff

  None (edit)
Description Maarten Broekman 2007-08-30 15:49:50 EDT
Description of problem:
When I rebuild my kdump image after updating kdump.conf, I am told that there 
isn't space enough for the vmcore file on my remote server (for scp).

Warning: There is not space enough to save a vmcore.
         The size of netdump@xx.xx.xx.xx:/var/crash/tmp.DOWHY25340 should be 
much greater than 16502136 bytes.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.  Configure kdump to scp to a remote server
2.  Make sure the remote server has less than your server's memory of USED 
space on the appropriate filesystem
3.  Restart kdump.
Actual results:
warning about less than 16G of space available

Expected results:
No warning when less than 16G of space used.

Additional info:
The remote_df check in mkdumprd is referencing field 10 of the output.  This 
field is the _used_ filesystem space.  The _available_ filesystem space is 
field 11.  As long as there is sufficient _available_ space, we shouldn't get 

Also, the message states that I should have at least that many _bytes_ of free 
space.  In actuality, it should be kilobytes.
Comment 1 Maarten Broekman 2007-08-30 15:49:50 EDT
Created attachment 181721 [details]
command output
Comment 2 Neil Horman 2007-08-30 16:03:04 EDT
Created attachment 181761 [details]
patch to make df output posix compliant in ssh case

I think this is what you need.	Please use it to patch mkdumprd and let me know
if it fixes your problem.  Thanks
Comment 3 Maarten Broekman 2007-08-30 16:37:09 EDT
Created attachment 181921 [details]
Patch (method 1)

The simplest patch is a 1 character change from -f10 to -f11.
Comment 4 Maarten Broekman 2007-08-30 16:39:07 EDT
Created attachment 181941 [details]
Patch (method 2)

This is a patch that is based off Neil's patch...it tails the df output before
returning it to mkdumprd (to remove the column headers).
Comment 5 Neil Horman 2007-08-30 19:25:53 EDT
in response to comment 3: Thats also the wrong patch.  The column number you cut
at will change based on the size of the mounted fs path, since w/o the -P option
on df it will insert newlines for readability.

in response to comment #4: Why are you tailing this twice?

Please just confirm the patch as I provided it to you.  Thank you
Comment 6 Maarten Broekman 2007-08-31 08:27:09 EDT
The patch you provided eliminated the warning but did not do the proper 
comparison.  The result of your patch was (running with bash -x):

++ ssh -q -o BatchMode=yes -o StrictHostKeyChecking=no netdump@ 
df -P /var/crash/tmp.QVTtV28107
+ remote_df='Filesystem         1024-blocks      Used Available Capacity 
Mounted on
/dev/cciss/c0d1p1     70005824    152748  69141852       1% /var/crash'
++ echo Filesystem 1024-blocks Used Available Capacity Mounted 
on /dev/cciss/c0d1p1 70005824 152748 69141852 1% /var/crash
++ tail -1
++ tr -s ' ' '|'
++ cut '-d|' -f4
+ available_size=Available
+ '[' Available -lt 16502136 ']'
/sbin/mkdumprd: line 1647: [: Available: integer expression expected

The second 'tail' is unneeded.

The field that is needed is number 11.  This is regardless of the newlines 
because of the way the output is returned and then echo'd.

remote_df may have newlines embedded, but when it is echo'd back for the 
purporses of tailling, translating, and cutting, the newlines seem to be 
ignored. (see above output).

Several ways around this are to use field 11 (since the newlines don't get 
echo'd into the pipelined commands in the current incarnation of the code) 
(aka patch in comment #3)...or to move the tail from the echo $remote_df line 
to the ssh command (patch in comment #4 minus the second tail)...or to combine 
the two and do all your pipelining within the ssh command so that the 
available space is returned from that rather than the whole df output.

see attachments
Comment 7 Maarten Broekman 2007-08-31 08:27:59 EDT
Created attachment 183161 [details]
corrected patch (method 2)
Comment 8 Maarten Broekman 2007-08-31 08:29:00 EDT
Created attachment 183181 [details]
unified patch

this performs all the parsing of df within the ssh command and returns the
available size.
Comment 9 Neil Horman 2007-08-31 09:37:51 EDT
oops, your right, the tail does need to be on the remote side.  I'll add the
patch from comment 7 to minimize remote side processing.  Thanks.  This will be
available in RHEL5.2
Comment 10 Maarten Broekman 2010-05-10 16:57:55 EDT
This has been fixed for quite a while.  This should be able to be closed now.

Note You need to log in before you can comment on or make changes to this bug.