Tuesday 22 December 2020

Prepare and create a RAID5 Array of 5 * 4TB Segate Barracuda Disks

 We need to prepare the disks as GPT labeled as they are > 2TB.

For each disk:

  • parted -a optimal /dev/sdx
  • mklabel gpt
  • mkpart primary 0% 100%
  • set 1 raid on
  • align-check optimal 1
  • print
  • quit

Create the array:
  • mdadm --create /dev/md0 --level=raid5 --raid-devices=5 /dev/sdx1 /dev/sdx1 /dev/sdx1 /dev/sdx1 /dev/sdx

In all of the above replace /dev/sdx1 with appropriates devices, e.g /dev/sda1 /dev/sda2 etc.

Tuesday 8 December 2020

Restrict ASUS laptop charge to 60% in Linux

 Dual booting my ASUS TUF laptop between Windows and Ubuntu 10.

The tools supplied by ASUS with Windows allows the battery charge to be limited to a specified %, the most agressive being 60%, in a bid to preserve battery life. Most laptops that are docked keep the battery at 100% and this kills the battery.

Found a good answer here:

https://askubuntu.com/questions/1006778/set-battery-thresholds-on-ubuntu-asus/1230442#1230442

I didn't have enough reputation on the site to leave a like or comment so I'm showing my appreciation here.

I did install tlp using "sudo apt install tlp" but not certain this is required.

After issuing the command "echo 60 | sudo tee /sys/class/power_supply/BAT1/charge_control_end_threshold" and adding the line "@reboot root echo 60 > /sys/class/power_supply/BAT1/charge_control_end_threshold"  to /etc/crontab, the output of "sudo tlp-stat -b" showed the charge at 78% and that the charge now was 0mA. It still shows as charging in the system tray but the % remains unchanging.

The reason I am not certain that TLP is required is because all the kernal modules listed in "tlp-stat -b" are showing as inactive and laptop not supported.

I've just unplogged my laptop and will let the percentage drop to below 60%, reconnect to the mains and see if the charging stops as hoped.

Sunday 22 November 2020

Getting Hyper-V to recognise a physical disk

 I'm running WSL2 and docker on my main machine and have noticed that even though Virtual Box will run, the reliability of the VMs is somewhat sub-par and often involves crashing.

I have taken to installing various Linux distros such as Ubuntu and Parrot on SSD drives in removable USB3 housings.

The main issue with installing Linux from USB boot media is the installation interferes with the Windows UEFI boot loader and can leave Windows unbootable without repairing this. However, if you do fix the Windows boot loader it stop Linux booting. There is probably a way to fix this but I haven't spent the time to do so yet.

My workaround has been to use Hyper-V to install Linux to a the removeable drive, however Hyper-V has an issue seeing the drive to add sometimes.

I found the answer here.

By following the proceedure at the bottom of the post, Hyper-V is able to see and add an SSD drive in a USB3 enclosure. This is limited to disks though, removable devices won't work in my experience.

Thanks to reid1000 you can follow the steps below:

  1. In Disk Management, offline the disk
  2. Right-click the disk and go to Properties > Policies tab
  3. Select the option "Better performance" then click OK. If prompted to restart your computer, click No.
  4. Again right-click the disk, go to Properties > Policies tab
  5. Select the option "Quick removal (default)" then click OK. If prompted to restart your computer, click No.
  6. In Hyper-V Manager, turn off the virtual machine. Then, open its settings and add the physical hard disk to the SCSI Controller.