Category: Tech

Using two ODROID HC2’s to create a small NAS with GLUSTERFS for PLEX server

My Mac Mini acting as a PLEX server was from late 2009 and had began stuttering when playing some recent high quality rips or transcoding.

It was time to upgrade.

Luckily I had an old i7-4790K processor laying around. I bought a case from amazon, and sourced a cheap 1150 motherboard locally. I also already had a 250gb SSD I wasn’t using. All I needed was some ram and I was in business.

I also wanted some form of storage and had heard about the ODroid HC2. I picked up the following gear from their site which came surprisingsly fast via DHL (a few days).

Then, from Amazon I picked up everything else.

Once I had everything wired up, and running I booted to the default OS using the DHCP addresses they got. Then I changed the IP to something static DHCP on my dhcp server, then added DNS through PFsense so my shared drives would be resolvable by name. Shit’s gettin’ real now dawg.

Then, I performed the following steps to get everything going.

  1. Install Arch Linux on Plex Server and configure (this would be a separate howto entirely). Install Plex Server or PlexPass Server.
  2. Plug your Odroids in, and get them on the network.
  3. SSH to both Odroids and then issue these commends on each one.
    # passwd
    # sudo apt-get install glusterfs-server
    # sudo service glusterfs-server start
    # sudo service glusterfs-server status
    # sudo apt-get install xfsprogs
    # gdisk /dev/sda
    
    p
    d
    n
    <enter><enter><enter><enter>
    w
    y
    
    # sudo mkfs.xfs /dev/sda1
    # sudo mkdir /data
    # sudo mount /dev/sda1 /data/
    # df -T
    # blkid /dev/sda1
    
    UUID=1234abc
  4. Now you’ll want to run the following differently on each odroid.
    droid1:
    echo "UUID=1234abc /data xfs defaults 1 1" | sudo tee --append /etc/fstab
    
    droid2:
    echo "UUID=5678xyz /data xfs defaults 1 1" | sudo tee --append /etc/fstab
  5. Then run these commands on both odroids
    # mount -a 
    # df -T
    # sudo mkdir -p /data/vol0
  6. Now run this on just one of the Odroids. Logically, I chose to do it on odroid1. Where mylocal.lan is my domain I use on pfsense.
    # sudo gluster peer probe droid2.mylocal.lan 
    # sudo gluster peer probe droid1.mylocal.lan
    # sudo gluster volume create vol0 replica 2 transport tcp droid1.mylocal.lan:/data/vol0 droid2.mylocal.lan:/data/vol0
    # sudo gluster volume info vol0
    # sudo gluster volume start vol0
  7. Then on your PLEX server, run these commands to mount up your gluster network, and auto mount it.
    # sudo mkdir -p /mnt/gluster 
    # sudo mount -t glusterfs -o acl droid1.mylocal.lan:/vol0 /mnt/gluster
    # df -hP /mnt/gluster
    # cat /proc/mounts
    # echo "droid1.mylocal.lan:/vol0 /mnt/gluster glusterfs defaults,_netdev,noauto,x-systemd.automount 0 0" | sudo tee --append /etc/fstab
  8. Now add some files to your gluster drive on the plex server. Then take a look at both your odroids. You should see the file exists in /data/vol0 as well on each of them. Congratulations you now have a replicating filesystem spread out over your two Odroids and used by Plex for storage.
  9. Now you should reboot all three devices to make sure everything comes up on a reboot, and that everything still functions. If it doesn’t check your logs and repeat anything above.

Here she is in all it’s glory on my Lack-Rack (heh).

 

Upgrading ElementalX, Android and Magisk on Google Pixel 2 on MacOS X

This is almost for sure the wrong way to do things, but this is my current process (as of apr 22, 2018) to upgrade my phone when new android releases are out, and/or new elemental x.

UPDATE TO LATEST FULL RELEASE OF ANDROID:

***IMPORTANT: REMOVE ‘-w’ from the ‘fastboot update’ line in the flash-all.sh (this will stop it from wiping the device).

  • Make sure you have already downloaded the latest Magisk ZIP (should be under ‘/sdcard/MagiskManager’, ex. ‘Magisk-v15.2.zip’)
  • Power off device
  • unzip the image.zip file
    # unzip image-walleye-opm2.171019.029.b1.zip
  • Boot the device into fastboot (power + down)
  • Run flash-all.sh
    # flash-all.sh
  • Let phone boot into the OS
  • Power off
  • Boot the device into fastboot (power + down)
  • Then, boot twrp
    # fastboot boot *TWRP.img path*
  • put in your password for twrp encryption and let it load into TWRP
  • now push your files to your pixel 2
    # adb push ElementalX-P2-1.05.zip /sdcard/Download
    # adb push Magisk-VERSION.zip /sdcard/Download
    # adb push /latest/release/boot.img /sdcard/Download
  • now click install, and install your files. install magisk and elementalx
  • wipe dalvik and cache, then reboot to system
  • open magisk check if rooted
  • if not, then install, patch boot file, pick boot.img and then
    # adb pull /sdcard/MagiskManager/patched_boot.img
    # adb reboot bootloader
    # fastboot flash boot patched_boot.img
    # fastboot reboot
  • Reboot the phone

TO UPGRADE ELEMENTAL X:

Perform the same steps as above, but just do the elementalX portion.

 

If anyone knows a better, quicker, way please let me know cause this is kinda annoying 🙂

Radeon RX 580 on Hackintosh OSX 10.13.4 Automatically Rotate Screen on Boot

Recently I got an ASUS Radeon RX 580 to replace an NVidia Card I was tired of fighting and trying to make work properly. As it turns out, no video card is very easy to get working with Hackintosh!

Anyway, today the problem was after finally getting two monitors working the secondary monitor was booting with a weird rotation and was a pain in the ass to change each time I logged in because the mouse was about 5″ off location on that screen.

There must be a way to automate it, thought I.

Here’s how I did it.

# cd ~/Documents/Source
# git clone https://github.com/CdLbB/fb-rotate.git
# cd fb-rotate
# gcc -w -o fb-rotate fb-rotate.c -framework IOKit -framework ApplicationServices
# nano /Users/YOURUSERNAME/Library/LaunchAgents/com.YOURCOMPUTERNAME.fb-rotate.plist

put this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>Label</key>
 <string>com.YOURUSERNAME.fb-rotate</string>
 <key>ProgramArguments</key>
 <array>
 <string>/Users/YOURUSERNAME/Documents/Source/rotate.sh</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
</dict>
</plist>

then get the list of your screens

# /Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -l

Which will output something like this

Display ID Resolution
 0xb430e32 1920x1080 [main display]
 0x2b287c4c 1200x1920

Take note of the screen you want to automatically rotate on boot. Copy the 0x00000 number.

# nano ~/Documents/Source/rotate.sh

And put fb-rotate command into the file

/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 0
/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 270

then make it executable

chmod +x ~/Documents/Source/rotate.sh

Now on your next reboot, it should auto flip your monitor the orientation you want. Obviously not a super elegant solution, but, whatever it’s done right, and, it work

If you want to test your scripts here they are testing:

to load:

launchctl load com.YOURUSERNAME.fb-rotate

to unload:

launchctl unload com.YOURUSERNAME.fb-rotate.plist