Skip to content

Commit

Permalink
vm: defer fstrim to after mount during provision (abiosoft#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
abiosoft authored Dec 19, 2022
1 parent 7384ed8 commit 02526c9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions environment/vm/lima/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,6 @@ func newConf(ctx context.Context, conf config.Config) (l Config, err error) {
Script: `grep -q "^rc_env_allow" /etc/rc.conf || echo 'rc_env_allow="*"' >> /etc/rc.conf`,
})

// trim mounted drive to recover disk space
l.Provision = append(l.Provision, Provision{
Mode: ProvisionModeSystem,
Script: `readlink /sbin/fstrim || fstrim -a`,
})
}

// network setup
Expand Down Expand Up @@ -242,6 +237,12 @@ func newConf(ctx context.Context, conf config.Config) (l Config, err error) {
Script: "mkmntdirs && mount -a",
})

// trim mounted drive to recover disk space
l.Provision = append(l.Provision, Provision{
Mode: ProvisionModeSystem,
Script: `readlink /sbin/fstrim || fstrim -a`,
})

if len(conf.Mounts) == 0 {
l.Mounts = append(l.Mounts,
Mount{Location: "~", Writable: true},
Expand Down

0 comments on commit 02526c9

Please sign in to comment.