Artisan Développeur

Qualité, amélioration continue, agilité.

Vagrant snapshot, safety first

When you want to test something, in my case it’s the upgrade to php7.3, I encourage you do use the really simple snapshot function of Vagrant.

First, see the VMs of your system:

vagrant global-status
id       name                        provider   state    directory                                              
--------------------------------------------------------------------------------------------------------------- 
0313ed0  default                     virtualbox poweroff /var/www/phpStorm/blog.xXXXx.com/trellis              
1407963  default                     virtualbox poweroff /var/www/phpStorm/xxx/xxxxx-com/trellis       
3879b77  default                     virtualbox running  /var/www/phpStorm/xxx-dev/xxxxxx-com/trellis   
ac34ac8  default                     virtualbox poweroff /var/www/phpStorm/xxx-dev                              
b292e76  default                     virtualbox running  /var/www/phpStorm/xxxxxxxx-com/trellis           
3fb0c96  default                     virtualbox running  /var/www/phpStorm/vagrant/xxxx                    
6e6b27f  default                     virtualbox running  /var/www/phpStorm/xxxxxx                               
2b7849a  poc-xxxxxx               virtualbox running  /var/www/phpStorm/laravel/projects/poc_xxx       
a8f3ca7  consume-channel-xxxxxx-api virtualbox running  /var/www/phpStorm/laravel/consume_channel_xxxxxx_api 

Some of these VMs are old, and not needed anymore, before I continue, I prefer to do some clean up first.

vagrant global-status --prune
id       name                        provider   state   directory                                              
-------------------------------------------------------------------------------------------------------------- 
6e6b27f  default                     virtualbox running /var/www/phpStorm/xxxxx                               
a8f3ca7  consume-channel-xxxxx-api virtualbox running /var/www/phpStorm/laravel/consume_channel_xxxxx_api 

A lot better ! Next the snapshot:

vagrant snapshot save 6e6b27f 2019_08_20_save_xxx_before_php_7_3
==> default: Snapshotting the machine as '2019_08_20_save_xxx_before_php_7_3'... 
==> default: Snapshot saved! You can restore the snapshot at any time by 
==> default: using `vagrant snapshot restore`. You can delete it using                                                                
==> default: `vagrant snapshot delete`.  

Really easy ! Last paranoid check before the upgrade:

vagrant snapshot list 
2019_08_20_save_xxx_before_php_7_3

Now I can break it all and restore my snapshot !

happy experiments

Leave a reply

Your email address will not be published.

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.