Skip to main content

Time Machine backup to NTFS without installing anything

· 2 min read

Here's a way to use an NTFS drive for Time Machine backups, even though it is used for other purposes too.

Find out the NTFS drive volume's UUID:

diskutil info /Volumes/DRIVENAME | grep UUID

Put this in fstab: (Replace ENTED_UUID_HERE with the one you found from the previous command.)

sudo echo "UUID=ENTER_UUID_HERE none ntfs rw,auto,nobrowse" >> /etc/fstab

Eject, plug out and back in. MAKE SURE THE DRIVE WAS SAFELY REMOVED FROM WINDOWS, or it will not mount RW in Mac (See dmesg when plugging in).

Find your RW mounted volume

open /Volumes

Now we will create a Mac OS disk image on the NTFS volume.

  1. Open Disk Utility
  2. Click New Image
  3. Select a large enough size
  4. Format: Mac OS Extended (Journaled)
  5. Partitions: Single Partition - Apple Partition Map
  6. When done, mount this image

Now we will tell Time Machine to use this disk. It does not show up in the list of available drives, so we will use a command:

sudo tmutil setdestination /Volumes/MOUNTED-DISK-IMAGE

(Replace MOUNTED-DISK-IMAGE with the disk image you created, NOT the NTFS drive)

Now just test backing up and see that it works.

Resources:

I use this for backing up to my NAS via SMB/NFS

XBMC memory leak remedy

· One min read

XBMC (now Kodi) has always had a tendency of leaking memory, so that it will eventually thrash and crash. My simple solution to this is to run xbmc inside a for loop instead of directly (just run the script from .xinitrc):

xbmc_angel.sh:

#!/bin/bash
while [ 1 ]; do
xbmc
nohup sleep 10
done

...And add the following to the local XBMC user's crontab:

0 4 * * *       killall xbmc.bin

This will kill XBMC every night at 4 o'clock. And give you a fresh XBMC every day!

How to download videos from Pepper Flash on linux

· One min read

The new Pepper Flash plugin broke my old script for listing/downloading cached flash/flv videos.

Here is a new script. Uses sudo because the /proc/$PID/fd directory is root only. This solution is based on silviot's solution here: http://superuser.com/questions/622606/how-do-i-save-the-buffered-flash-video-on-linux.

#!/bin/bash
for FLASHPID in $( pgrep -f chrom ) ; do (for FLASHFILE in $(sudo ls -l /proc/$FLASHPID/fd|egrep "(/tmp/Flash|Pepper Data)" | sed -r 's/^.* ([0-9]+) -> .*$/\1/'); do echo /proc/$FLASHPID/fd/$FLASHFILE; done ); done

Then you can just copy the file into home, like:

cp /proc/26493/fd/30 ~/

ReadyNAS RN102 constant activity remedy

· One min read

My Netgear ReadyNAS RN102 keeps constantly writing to a file /var/readynasd I don't want to hold my breath waiting for Netgear to fix this so I took matters into my own hands and implemented a TMPFS fix for my NAS. What it does is mount /var/readynasd as a tmpfs of 2MB, and copy files to here from /etc/readynas-db on every boot, and copy back every hour, and on shutdown.

Setup instructions​

systemctl stop readynasd
mkdir /etc/readynasd-db
cp -a /var/readynasd /etc/readynasd-db/

Edit /lib/systemd/system/tmpdb.service:

[Unit]
Description=Mount RAMFS for SQLITE DB file
Before=readynasd.service

[Service]
Type=oneshot
ExecStart=/bin/sh -c "mount -t tmpfs -o size=2m tmpfs /var/readynasd && cp -a /etc/readynasd-db/readynasd /var/"
#ExecStop=/bin/sh -c "cp -a /var/readynasd /etc/readynasd-db/" # TODO not working
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Edit /etc/cron.daily/tmpdb-sync

#!/bin/bash
cp -a /var/readynasd /etc/readynasd-db/

Now finish up:

chmod +x /etc/cron.daily/tmpdb-sync
systemctl enable tmpdb
reboot

ReadyNAS startup/boot script

· One min read

I needed to add some startup command to run as root on my Netgear ReadyNAS (RN102). Turns out you don't have any /etc/rc.local, so I added a new boot script /etc/init.d/local:

#! /bin/sh
### BEGIN INIT INFO
# Provides: local
# Required-Start: $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Local scripts
# Description: Local scripts
### END INIT INFO

PATH=/sbin:/bin
. /lib/init/vars.sh

do_start () {
hdparm -S 253 /dev/sdc
}

case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac

:

Just type whatever u need inside do_start. I needed to set a higher spindown timeout.

Then:

chmod +x /etc/init.d/local
update-rc.d local defaults

Tested on ReadyNASOS 6.1.6