Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5.2: free space check uses wrong column in Ubuntu #38

Closed
lhurt opened this issue Aug 28, 2010 · 4 comments
Closed

1.5.2: free space check uses wrong column in Ubuntu #38

lhurt opened this issue Aug 28, 2010 · 4 comments

Comments

@lhurt
Copy link

lhurt commented Aug 28, 2010

Got "There is not enough free space on /tmp to create the new file." on pretty full drive.

found in line 486
WDFREESPACE=$(\df -k "$WD" | tail -1 | awk '{print $4*1024}')
but
\df -k "$WD" | tail -1
gives
1939175428 1913048748 26126680 99% /
on my Ubuntu system
and awk uses the 4th column instead of the 3rd which is supposedly wrong

\df -k /tmp/ | tail -1 | awk '{print $4}' results in
99%
which is obviously wrong

\df -k /tmp/ | tail -1 | awk '{print $3}' results in
26126680
which is correct.
and btw it doesn't have to be multiplied by 1024 as done in your script since the result is already in kilobytes. But this is already addressed in issue #37.

It is not to my knowledge if this only applies to Ubuntu, but may be it's worth a check.

@choekstr
Copy link
Collaborator

Can you paste the full df -k output from your ubuntu system (df -k by itself)? My Ubuntu 9.x and 10.x systems both require the 4th field as the first one, seemingly blank on your output, is the disk device:

$ df -k /tmp
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1            298756768 133182284 150398500  47% /

@lhurt
Copy link
Author

lhurt commented Aug 30, 2010

My system setup is using a LVM volume which results in a different df output

$ df -k /tmp
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/mapper/fileserver-root
                 1939175428 1933174668   6000760 100% /

The terminal window would have been wide enough to print the data in one line. This seems to be a df related behavior. Sometimes it's astonishing what you have to take into account when programing, isn't it?

May be this can be solved by adding the -P option to df resulting in df -kP /tmp which prints
$ df -kP /tmp
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/fileserver-root 1939175428 1933174724 6000704 100% /
and should be usable for the script. Alas I'm not sure if this is platform independant.

hope that helps

@coredump
Copy link

coredump commented Nov 4, 2010

I had the same error and fixed using the -P option. In my case the wrong column is used because the drive name is really long:
/dev/mapper/crypthome
115047996 77261932 31941944 71% /home

@JakeWharton
Copy link
Owner

Fixed by c1204a1.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants