For GNS3 below versions 1+
(config)#vtp file flash:vlan.dat
Setting device to store VLAN database at filename flash:vlan.dat.
(config)#vtp file nvram:vlan.dat
Setting device to store VLAN database at filename nvram:vlan.dat.
(config)#do wr mem
Building configuration
After that you can configure your vlans and vtp configuration without losing the information.
Make sure you save the project with the option "save nvrams and virtual hard drives" checked.
In case you encounter the error message:
% not enough space on flash to store vlan database. trying squeeze...
Then you can try:
#erase flash:
Erasing the flash filesystem will remove all files! Continue? [confirm]
Erasing device...
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee ...erased
Erase of flash: complete
Then all VTP and VLAN operations should work correctly.