Hi,
I have found that mount command ignores [gmk] suffixes (GB, MB, kB) when
tmpfs size is defined in fstab (or directly used with mount). Expected
behavior is as follows (Debian linux):
# mount -t tmpfs -o rw,nosuid,size=100m,mode=1777 tmpfs /xxx
# df -h /xxx
Filesystem Size Used Avail Use% Mounted on
tmpfs 100M 0 100M 0% /xxx
kfreebsd:
# mount -t tmpfs -o rw,nosuid,size=100m,mode=1777 tmpfs /xxx
# df -h /xxx
Filesystem Size Used Avail Use% Mounted on
tmpfs 7.0G 4.0K 7.0G 1% /xxx
It must be defined in bytes:
# mount -t tmpfs -o rw,nosuid,size=104857600,mode=1777 tmpfs /xxx
# df -h /xxx
Filesystem Size Used Avail Use% Mounted on
tmpfs 100M 4.0K 100M 1% /xxx
Which is ok if you know about it and define the size in you fstab in
bytes (contrary to several Debian articles info). But the
/lib/init/tmpfs.sh uses kilobytes in its calculations and return values
(e.g. RET="${RET}k"), therefore the default size of tmpfs file systems
calculated as percentage from memory size might be wrong. Basically,
this change helped me:
< RET="${RET}k"
> RET=$((RET*1024))
however do not know whether it is not used also somewhere else.
Regards
Vaclav