virt-lightning / freebsd-cloud-images

Shell script to build the FreeBSD cloud images
30 stars 13 forks source link

Trim disabled in FreeBSD 14.0 UFS #8

Open oneumyvakin opened 3 months ago

oneumyvakin commented 3 months ago

Is it possible to enable trim on /dev/da0p4 on building image?

Enabling TRIM/DISCARD command telling to free blocks to underline device. Without supporting this command underling thin storages like QCOW2 or ThinLVM will grow infinetely.

 tunefs -p /dev/da0p4
tunefs: POSIX.1e ACLs: (-a)                                disabled
tunefs: NFSv4 ACLs: (-N)                                   disabled
tunefs: MAC multilabel: (-l)                               disabled
tunefs: soft updates: (-n)                                 enabled
tunefs: soft update journaling: (-j)                       disabled
tunefs: gjournal: (-J)                                     disabled
tunefs: trim: (-t)                                         disabled
tunefs: maximum blocks per file in a cylinder group: (-e)  4096
tunefs: average file size: (-f)                            16384
tunefs: average number of files in a directory: (-s)       64
tunefs: minimum percentage of free space: (-m)             8%
tunefs: space to hold for metadata blocks: (-k)            4952
tunefs: optimization preference: (-o)                      time
tunefs: volume label: (-L)                                 FreeBSD

Unfortunately it's not possible to enable it in running VM:

# tunefs -t enable /dev/da0p4
tunefs: issue TRIM to the disk set
tunefs: /dev/da0p4: failed to open disk for writing
goneri commented 3 months ago

I understand the command should be called here: https://github.com/virt-lightning/freebsd-cloud-images/blob/master/build.sh#L56

Right?