EK bio photo


Totally not a hacker

Email Twitter Github

Migrate ArchLinux from HDD to SDD

System prepare

# clean pacman cache
$ pacman -Scc

Boot from the Arch liveCD

# partitioned via gdisk /dev/sdb1 for /boot 1G and /dev/sdb2 for / with all space

$ gdisk /dev/sdb
$ mkfs.ext4 /dev/sdb1
$ mkfs.ext4 /dev/sdb2
$ mount /dev/sdb2 /mnt
$ mkdir /mnt/boot
$ mount /dev/sdb1 /mnt/boot
$ mkdir /mnt_old
$ mount /dev/sda3 /mnt_old
$ rsync -aAXv --progress /mnt_old /mnt
$ genfstab -U -p /mnt > /mnt/etc/fstab
$ mount --bind /dev /mnt/dev
$ mount --bind /proc /mnt/proc
$ mount --bind /sys /mnt/sys
$ chroot /mnt /bin/bash
$ grub-install --debug --recheck /dev/sdb
$ grub-install --target=i386-pc --debug --recheck /dev/sdb
$ grub-mkconfig -o /boot/grub/grub.cfg
$ mkinitcpio -p linux

Edit fstab

# add noatime,discard for SSD partions
echo "tmpfs   /tmp       tmpfs   defaults,noatime,mode=1777   0 0" >> /etc/fstab

Enable deadline scheduler for SSD

$ vi /etc/udev/rules.d/60-schedulers.rules
ACTION=="add|change", KERNEL=="sdb", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"

Enable FSTRIM service

$ systemctl enable fstrim.service

Exit chroot add reboot

$ exit
$ reboot