technology

Mounting SSD drive as swap in VM

First of all this SSD drive which I use is somehow faulty. It is a Goodram SSDPR-CX400-01T-G2 drive of 1TB. It have been working fine for few weeks until some construction worker made a electric short causing some abnormal frequences in wires resulting a faulty drives and memory sticks. One of victim was this drive:

  • in CrystalDisk it is reports as good,
  • but in Ubuntu disks utility it supposedly has 1 bad block
  • badblocks -svt 0x00 /dev/sdX shows no bad blocks
  • zeroing with dd and veryfing with cmp is fine

    This drives for sure has some issues as at least one of tools shows that it as a problematic badblocks. Second of all in regular use it fails to run VM. It once switched into read-only mode in VM filesystem then after formatting it it refused to restore VM from backup. So last thing in which it might be useful is being storage for swap:

    mkswap -c /dev/sdX
    swapon /dev/sdX
    

    Then in /etc/fstab:

    /dev/sdX none swap sw
    

    I set it in VM as 256 GB drive, why? Because I encountered some leaking Ruby libraries in my project and program required way more memory than it should have actually require, so the temporary solution is to increase available memory by adding such a huge amount of swap.

    WordPress Appliance - Powered by TurnKey Linux