Home > Kernel, Unix > Extending tmpfs’ed /tmp on Solaris 10(and linux) without reboot

Extending tmpfs’ed /tmp on Solaris 10(and linux) without reboot

November 3rd, 2011


Thanks to Eugene.

If you need to extend /tmp that is using tmpfs on Solaris 10 global zone (works with zones too but needs adjustments) and don’t want to undertake a reboot, here’s a tried working solution.

PLEASE BE CAREFUL, ONE ERROR HERE WILL KILL THE LIVE KERNEL!

echo “$(echo $(echo ::fsinfo | mdb -k | grep /tmp | head -1 | awk ‘{print $1}’)::print vfs_t vfs_data \| ::print -ta struct tmount tm_anonmax | mdb -k | awk ‘{print $1}’)/Z 0×20000″ | mdb -kw

Note the 0×20000. This number means new size will be 1GB. It is calculated like this: as an example, 0×10000 in hex is 65535, or 64k. The size is set in pages, each page is 8k, so resulting allocation size is 64k * 8k = 512m. 0×20000 is 1GB, 0×40000 is 2GB etc.

If the server has zones, you will see more then one entry in ::fsinfo, and you need to feed exact struct address to mdb. This way you can change /tmp size for individual zones, but this can only be done from global zone.

Same approach can probably be applied to older Solaris releases but will definitely need adjustments. Oh, and in case you care, on Linux it’s as simple as “mount -o remount,size=1G /tmp” :)

 


support_me
Amounts
Categories: Kernel, Unix Tags:
  1. No comments yet.
  1. No trackbacks yet.