Migrate to SSD

In my previous post, I mentioned I have boot issue. Then I asked in Arch Linux BBS, and I got some useful advice from other users. As a result, I contacted a computer shop in my town, in order to get a hard drive (HDD). However, the shop doesn’t have 7200 rpm HDD. Then he suggested SSD to me, which is 1T storage. The SSD now is much cheaper comparing to two years ago.

I remembered that SSD, requires some special configuration, due to “limited write-life” [1]. Spending around one week time, I searched for the recommended tweaks and modified the setup in order to cope my working environment.

The following is the summary of my SSD configurations:

  1. The partitions should be mounted with noatime option.
  2. When creating partition, should be aligned properly, which fdisk should handle it automatically. [2]
  3. Enable fstrim
  4. Do not use swap partition, as fstrim does not work on swap partition [3][4]. Though, “swap system has automatically supported TRIM capable devices” [5]
  5. 8G RAM is not enough for my working environment. I created swap file instead of swap partition
  6. Set swappiness [6]
  7. If 8G RAM is enough, then can use zram (using zram-generator).

[1] Dell, “Hard Drive – Why Do Solid State Devices (SSD) Wear Out,” Dell.com, Sep. 28, 2021. https://www.dell.com/support/kbdoc/en-my/000137999/hard-drive-why-do-solid-state-devices-ssd-wear-out. (accessed Apr. 14, 2022).

[2] “Should I align partitions on an SSD, if so how do I do it at install time?,” Ask Ubuntu, Dec. 26, 2010. https://askubuntu.com/questions/18900/should-i-align-partitions-on-an-ssd-if-so-how-do-i-do-it-at-install-time#18951 (accessed Apr. 16, 2022).

[3] “fstrim does not trim swap,” Unix & Linux Stack Exchange, Dec. 12, 2019. https://unix.stackexchange.com/questions/556805/fstrim-does-not-trim-swap#558223 (accessed Apr. 16, 2022).

[4] “why not use Swap file on SSDs instead of Swap partition?,” Ask Ubuntu, Nov. 11, 2016. https://askubuntu.com/questions/848230/why-not-use-swap-file-on-ssds-instead-of-swap-partition?noredirect=1&lq=1#1290562 (accessed Apr. 16, 2022).

[5] “SwapFaq – Community Help Wiki,” Ubuntu.com, 2022. https://help.ubuntu.com/community/SwapFaq (accessed Apr. 16, 2022).

[6] Why, “Why are swap partitions discouraged on SSD drives, are they harmful?,” Ask Ubuntu, Jul. 24, 2015. https://askubuntu.com/questions/652337/why-are-swap-partitions-discouraged-on-ssd-drives-are-they-harmful#964933 (accessed Apr. 16, 2022).


Not able to boot

Recently, I failed to boot into my laptop. I was shocked.

home contains a file system with errors, check forced.
home: Inode 12976129 seems to contain garbage.
home: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e., without -a or -p options)
fsck failed with exit status 4.

Then not able to mount the home partition, I was prompted to login as root. However, I was too nervous, I forgot what is my root password.

Luckily, I always have an Arch Linux LiveUSB, though it was 2020 release. I boot into it. Then the screen is tearing, due to the graphic card issue (NVidia). I tried to remember how I did the installation previously. At the end, it involves BIOS to change the graphic card to non Discrete Graphic Card. Boot again, yes, success boot into LiveUSB.

The next thing is, I immediately run fsck to check the partition again. And auto fix all prompts.

During the fix, fsck shows me such frightening screen.

Luckily there is no read error caused by bad sector.

After finish running fsck, I reboot and no more issue to boot into Linux.

Backup! Backup! And always do backup! And I should remember my root password!