Is it okay to use `mkfs.ext4` on each boot? (first-time impermanence setup)

I recently rewrote my config and decided to give impermanence a shot.

Right now I’m using ext4 for the ephemeral root partition and I’m reformatting on each reboot (here’s the mkfs snippet). The setup uses two SSDs with LVM + striping so the writes are distributed equally.

Will this wear out my SSDs fast? can I test this and see how much data the formatting writes to the SSDs?

1 Like

Use smartctl from smartmontools to find the Percentage Used: and Data Units Written: of the SSD before and after formatting with sudo smartctl -a /dev/<your-nvme-device>.

I’m curious; may I ask why you’re using ext4 for this rather than then more common tmpfs or btrfs subvolumes?

1 Like

The formatting just writes new headers. It’s basically nothing. You don’t need to worry about SSD wear (it’s a drastically overblown concern in the first place).

4 Likes

But the MBR is always at sector 0, so eventually the write head will wear a groove in the disk there :slight_smile:

(More serious answer: I think reformatting ext4 is a great idea, if you don’t have enough memory for a tmpfs, although I believe it doesn’t take much - my root on tmpfs is currently using only 2 MB of memory.)

4 Likes

I want to be able to download large files outside the persistence mounts so tmpfs would be risky. I don’t use btrfs because I had performance issues with it (IOPS around 10k) but I suspect I somehow misconfigured something.

So I chose ext4 because I wanted a “classic” setup with no caveats

3 Likes

Just tested with smartctl right before/after the formatting in initrd and the wear is negligible. It writes about 270 MiB per drive.

1 Like