Pi3b+ with additional harddisk
Posted: Saturday 24 August 2019 14:09
Maybe this is an idea for others, because this little hardware hack is around 20 bucks.
To prevent the wear out of your SD-Card, folders should be moved out from the card to a more robust memory. After a short view in the second hand i figured out that there are many tiny 1.8" ZIF harddisc's from audio players at the bay. As size have a look for 20gig but don't waste money for huge sizes. These tiny harddisc types require a cheap metal case with usb connector, you can get them most times below 10 bucks. Here is a video so you can see how to fit it.
https://youtu.be/P11Bbt2GX_8
Because you don't need and want to have the whole system on the harddisc as it's slower than the sd card, you like to place busy folders into separate partitions. Here as example how i did partition my 20gig drive in GPT mode.
Disk /dev/sda: 18,6 GiB, 20003880960 bytes, 39070080 sectors
Disk model: 0G5CE00
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/sda1 2048 23420927 23418880 11,2G Linux filesystem
/dev/sda2 23420928 35067903 11646976 5,6G Linux filesystem
/dev/sda3 35067904 39069695 4001792 1,9G Linux swap
To add the disc to your raspbian, stop the domoticz service. Here sda1 is for the /home partition, so mount this for example at /mnt and copy all from /home on your sd card to the new partition. If you use "cp -pdRxv /home. /mnt/" it will prevent the permissions for all files. After that do the same with the /var partition that contains all logs, package archives and temporary files.
After copy the /etc/fstab have to be changed, to get the new partitions included into the sd card system at next boot.
Possible result.
domoticz@domosys:~$ more /etc/fstab
proc /proc proc defaults 0 0
PARTUUID=6512e388-01 /boot vfat defaults 0 2
PARTUUID=6512e388-02 / ext4 defaults,noatime 0 1
/dev/sda1 /home ext4 defaults 0 1
/dev/sda2 /var ext4 defaults 0 1
/dev/sda3 swap swap defaults 0 0
After reboot the system will work with /home and /var on the harddisc and have a swap partition if memory will ever get a problem. The result can be probed with the df command.
domoticz@domosys:~$ df
Dateisystem 1K-Blöcke Benutzt Verfügbar Verw% Eingehängt auf
/dev/root 14780780 1769672 12378008 13% /
devtmpfs 443152 0 443152 0% /dev
tmpfs 447760 0 447760 0% /dev/shm
tmpfs 447760 22872 424888 6% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 447760 0 447760 0% /sys/fs/cgroup
/dev/mmcblk0p1 258096 40049 218047 16% /boot
/dev/sda1 11456638 1544948 9322122 15% /home
/dev/sda2 5697645 518633 4883742 10% /var
So the machine does have the fast sd-card boot and the robust harddisk partitions for busy places. Here i fitted the metal case with double sided stripes and a short usb cable on top to the Icy Box. For startup current on USB2 connectors the raspi need this line in /boot/config.txt to have enough power.
#USB-Current
max_usb_current=1
If there are questions left, just ask:-)
Solderbro
To prevent the wear out of your SD-Card, folders should be moved out from the card to a more robust memory. After a short view in the second hand i figured out that there are many tiny 1.8" ZIF harddisc's from audio players at the bay. As size have a look for 20gig but don't waste money for huge sizes. These tiny harddisc types require a cheap metal case with usb connector, you can get them most times below 10 bucks. Here is a video so you can see how to fit it.
https://youtu.be/P11Bbt2GX_8
Because you don't need and want to have the whole system on the harddisc as it's slower than the sd card, you like to place busy folders into separate partitions. Here as example how i did partition my 20gig drive in GPT mode.
Disk /dev/sda: 18,6 GiB, 20003880960 bytes, 39070080 sectors
Disk model: 0G5CE00
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Device Start End Sectors Size Type
/dev/sda1 2048 23420927 23418880 11,2G Linux filesystem
/dev/sda2 23420928 35067903 11646976 5,6G Linux filesystem
/dev/sda3 35067904 39069695 4001792 1,9G Linux swap
To add the disc to your raspbian, stop the domoticz service. Here sda1 is for the /home partition, so mount this for example at /mnt and copy all from /home on your sd card to the new partition. If you use "cp -pdRxv /home. /mnt/" it will prevent the permissions for all files. After that do the same with the /var partition that contains all logs, package archives and temporary files.
After copy the /etc/fstab have to be changed, to get the new partitions included into the sd card system at next boot.
Possible result.
domoticz@domosys:~$ more /etc/fstab
proc /proc proc defaults 0 0
PARTUUID=6512e388-01 /boot vfat defaults 0 2
PARTUUID=6512e388-02 / ext4 defaults,noatime 0 1
/dev/sda1 /home ext4 defaults 0 1
/dev/sda2 /var ext4 defaults 0 1
/dev/sda3 swap swap defaults 0 0
After reboot the system will work with /home and /var on the harddisc and have a swap partition if memory will ever get a problem. The result can be probed with the df command.
domoticz@domosys:~$ df
Dateisystem 1K-Blöcke Benutzt Verfügbar Verw% Eingehängt auf
/dev/root 14780780 1769672 12378008 13% /
devtmpfs 443152 0 443152 0% /dev
tmpfs 447760 0 447760 0% /dev/shm
tmpfs 447760 22872 424888 6% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 447760 0 447760 0% /sys/fs/cgroup
/dev/mmcblk0p1 258096 40049 218047 16% /boot
/dev/sda1 11456638 1544948 9322122 15% /home
/dev/sda2 5697645 518633 4883742 10% /var
So the machine does have the fast sd-card boot and the robust harddisk partitions for busy places. Here i fitted the metal case with double sided stripes and a short usb cable on top to the Icy Box. For startup current on USB2 connectors the raspi need this line in /boot/config.txt to have enough power.
#USB-Current
max_usb_current=1
If there are questions left, just ask:-)
Solderbro