I have VirtualBox 4.1.14 on Windows 7 as host, and Ubuntu server 11.10 as guest. System was installed at traditional HDD years ago (and upgraded later), but now it's at SSD as expanding drive. There is "AHCI" and "it's SSD" features enabled in SATA controller. Problem is, this expanding drive growth to it's almost max size (90% of it), but actually in VM only about 50% spent. Also, guest VM does not recognize /dev/sda as SSD, /sys/block/sda/queue/rotational says "1", /sys/block/sda/queue/discard_* all says "0". And, of course, I cannot run fstrim /, it says that operation not supported. Is there some trick to enable TRIM support in my guest system without reinstalling it?
Enable TRIM in the host OS, not the guest. The virtual disk resides as a large file on the host file system, and disk writes in the guest get translated to disk writes on your host, where TRIM will be applied if enabled.
TRIM doesn't help you anyway for virtual disks. The purpose of TRIM is let the SSD know which sectors are unused, but every sector of the virtual disk file is considered to be still in use by the host, and it doesn't decrease in size so none of it will ever be flagged as unused by TRIM.