FSTRIM Syntax

What is the correct command line syntax for the FSTRIM command?
While I am a new Haiku user, I used BeOS in the past and still have BeOS Pro Edition 5.0 and a copy of The BeOS Bible. I use Linux.

I installed the latest beta - 3 - on an old laptop with an SSD. I had read the website info beforehand and saw that fstrim is a supported command. So when I ran fstrim I instinctively typed “fstrim /” - the Linux syntax - and got “Trim failed: invalid argument.” “Trim – help” returns <path-to-mounted -filesystem> so then I tried “fstrim /dev/disk/scsi/0/0/0/0” and this returned “Trimming failed: not a TTY.”

I am pretty sure TRIM was disabled on beta3 due to a lot of bugs. Most of those have been fixed on the nightlies, though.

/ is not exactly a mounted filesystem, it’s the virtual root that all other filesystems are mounted at. Probably what you wanted is fstrim /boot.

1 Like

Thanks for the reply. I tried fstrim /boot and got “Trimming failed: invalid argument.”

I read the posts from 5-6 years ago about trim problems but thought this had been cleared up by now. I have a laptop I can use for Haiku but don’t want to subject the SSD to avoidable wear.

You can try upgrading to a nightly build and see if TRIM works for you then.

1 Like

Is the nightly build a patch, or a completely new installation?
Where on the website are instructions to do this?

Scroll down to the section “Nightly (unstable) Builds” to find the relevant info.

Please note, though, that adding the nightly repositories to the config will replace the default “stable” R1/beta3 repository URLs with the nightly repo URLs. The nightly builds are updated far more frequently, but also break things from time to time.

To go back to the stable repository configuration, just perform the procedure in the “Stable Builds” section.

1 Like

I have room on the SSD for a second installation, so I can use it for the latest nightly build.
If I rerun the boot loader utility in my original installation, will it pick up the second installation, i.e. the nightly build?

If it is on the same SSD and you boot using legacy BIOS, yes, you can use our bootmanager to have a menu where you can select which partition to boot.
In other cases (booting with EFI, or if you have multiple disks) you need to use another bootloader, because ours currently isn’t capable of doing it.

I installed the 11/24/21 nightly in a separate partition. The partition tool showed the mounting point to be /Haiku2. This contrasts with /boot in the Beta 3 install.
I ran fstrim /Haiku2, got a warning that trim support is experimental and may destroy data, but proceeded. Fstrim ran and reported the number of bytes trimmed. I then mounted Beta 3, which was at mount point /Haiku1,and ran fstrim on this mount point. It too ran and reported.

Continuing: I restarted Beta 3 and it appears to be functioning normally so far, and did likewise for the nightly. So it appears I can use Beta 3, and periodically run the nightly for trimming.

I ran the boot manager from Beta 3 to add the nightly. The nightly was added to the boot menu, but the nightly does not boot from the menu. I have to use my installation USB memory stick to boot the nightly.