Iemhof
Setup LVM
Create pv
pvcreate /dev/nvme0n1p3
Create vg iemhof and add nvme0n1p3
vgcreate iemhof /dev/nvme0n1p3
Create lvs
lvcreate --name root --size 35G iemhof lvcreate --name var --size 50G iemhof lvcreate --name janarie --size 50G iemhof lvcreate --name nc-data --size 650G iemhof lvcreate --name swap --size 16G iemhof
Install base system
Install Debian 13 Trixie using lvm with user janarie. Choose xfce desktop and common system utilities
Edit boot order
Set Debian on top:
root@iemhof:~# efibootmgr -o 0003,0000,2001,3000 BootCurrent: 0003 Timeout: 0 seconds BootOrder: 0003,0000,2001,3000 Boot0000* Windows Boot Manager HD(1,GPT,c496420a-e785-49da-add5-12d97b134f02,0x800,0x1e8000)/File(\EFI\Microsoft\Boot\bootmgfw.efi)RC Boot0003* debian HD(1,GPT,c496420a-e785-49da-add5-12d97b134f02,0x800,0x1e8000)/File(\EFI\debian\shimx64.efi) Boot2001* EFI USB Device RC Boot3000* Internal Hard Disk or Solid State Disk RC
Install utilities
root@iemhof:~# apt install vim screen htop tree curl unzip locate
Enable autologin
root@iemhof:~# cat /etc/lightdm/lightdm.conf # # General configuration # # start-default-seat = True to always start one seat if none are defined in the configuration # greeter-user = User to run greeter as # minimum-display-number = Minimum display number to use for X servers ... autologin-user=janarie autologin-user-timeout=0 ... #listen-address= #width=1024 #height=768 #depth=8
Call pp for ip
root@paardenpad:/var/www/html/ip# ls -l
total 8
-rw-r--r-- 1 www-data www-data 0 Aug 9 16:13 iemhof_ip
-rw-r--r-- 1 www-data www-data 39 Jul 12 12:38 index.php
-rw-r--r-- 1 www-data www-data 350 Aug 9 16:14 post.php
root@paardenpad:/var/www/html/ip# cat index.php
<?php echo $_SERVER['REMOTE_ADDR']; ?>
root@paardenpad:/var/www/html/ip# cat post.php
<?php
if (isset($_POST['username']) && isset($_POST['password']) && isset($_POST['ip'])) {
if(isIemhof($_POST)) {
writeIemhof($_POST);
}
}
function isIemhof($POST) {
return $POST['username'] == 'iemhof' && $POST['password'] == 'qui2Niab';
}
function writeIemhof($POST) {
file_put_contents(iemhof_ip, $POST['ip']);
}
?>
Set following script into cronjob
root@iemhof:~/scripts# cat phoneHome #!/bin/bash curl https://phone-home.geitenpad.rijkenmiel.nl/ | xargs -i curl --data "username=iemhof&password=oongeez4noch9dahl4AhPhequ&ip={}" https://phone-home.geitenpad.rijkenmiel.nl/post.php
Add line to /etc/crontab:
0 7 * * * root /root/scripts/phoneHome
Backup Nextcloud
BackupNCIemhof.sh (/root/scripts/backupNc in cron)
#!/bin/bash WORK_DIR="/root" BACKUP_FILE="nc_iemhof.sql" STACK_SERVER="rijkierijk.stackstorage.com" STACK_USER="janarie@rijkierijk.stackstorage.com" export SSHPASS='SJMebb6AQFkDODSm' echo `date` cd $WORK_DIR mysqldump --lock-tables -u nextcloud --password='Md8NqM1MbVY31hHX' -h 127.0.0.1 -P 3310 nextcloud > $WORK_DIR/$BACKUP_FILE sshpass -e sftp -oBatchMode=no -b - $STACK_USER@$STACK_SERVER << ! put nc_iemhof.sql bye ! rm -rf $BACKUP_FILE
Add Docker
root@iemhof:~# apt install apt-transport-https ca-certificates curl gpg root@iemhof:~# curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker.gpg root@iemhof:~# echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker.gpg] https://download.docker.com/linux/debian trixie stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null root@iemhof:~# apt update root@iemhof:~# apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Install landisplusgyr
root@iemhof:~# usermod -a -G dialout janarie
Build container:
root@iemhof:~/git/iemhof/landisplusgyr# docker build . -t landisplusgyr
Run container:
root@iemhof:~/git/iemhof/landisplusgyr# docker run -p 8090:8080 -v /home/janarie/landisplusgyr/:/landisplusgyr/ --device=/dev/ttyUSB0 --restart always landisplusgyr
Create cleanup job in crontab:
0 0 1 * * janarie mv /home/janarie/landisplusgyr/landisplusgyr_electricity.csv /home/janarie/landisplusgyr/landisplusgyr_electricity_$(date +\%Y\%m\%d).csv
Give the complete disk to Jan Arie
List current partitions
root@iemhof:~# fdisk -l Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk model: WDC WD10SPZX-21Z Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x7bb20f4f Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 1918363647 1918361600 914.8G 5 Extended /dev/sda2 1918363648 1953523711 35160064 16.8G 82 Linux swap / Solaris /dev/sda5 4096 1228804095 1228800000 586G 83 Linux
Create partion
root@iemhof:~# fdisk /dev/sda
Add partition with n
root@iemhof:~# fdisk -l Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors Disk model: WDC WD10SPZX-21Z Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 4096 bytes Disklabel type: dos Disk identifier: 0x7bb20f4f Device Boot Start End Sectors Size Id Type /dev/sda1 * 2048 1918363647 1918361600 914.8G 5 Extended /dev/sda2 1918363648 1953523711 35160064 16.8G 82 Linux swap / Solaris /dev/sda5 4096 1228804095 1228800000 586G 83 Linux /dev/sda6 1228806144 1918363647 689557504 328.8G 83 Linux
Change partition type to lvm
root@iemhof:~# fdisk /dev/sda Welcome to fdisk (util-linux 2.33.1). Changes will remain in memory only, until you decide to write them. Be careful before using the write command. Command (m for help): t Partition number (1,2,5,6, default 6): 6 Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM'. Command (m for help): w The partition table has been altered. Syncing disks.
Reload partion table
partprobe
Create physical volume
root@iemhof:~# pvcreate /dev/sda6 Physical volume "/dev/sda6" successfully created.
Add /dev/sda6 to volume group
root@iemhof:~# vgextend iemhof /dev/sda6 Volume group "iemhof" successfully extended
Add space to lv van Jan Arie
root@iemhof:~# lvextend -L+329G /dev/iemhof/ja Size of logical volume iemhof/ja changed from 100.00 GiB (25600 extents) to 429.00 GiB (109824 extents). Logical volume iemhof/ja successfully resized.
Resize filesystem
root@iemhof:~# resize2fs /dev/iemhof/ja resize2fs 1.44.5 (15-Dec-2018) Filesystem at /dev/iemhof/ja is mounted on /home/janarie; on-line resizing required old_desc_blocks = 13, new_desc_blocks = 54 The filesystem on /dev/iemhof/ja is now 112459776 (4k) blocks long.
Remove extra space from Jan Arie
Stop landisplusgyr
root@iemhof:/home/janarie/landisplusgyr# docker container stop 66
Unmount janarie
root@iemhof:~# umount -l /home/janarie/
Remove janarie from fstab
root@iemhof:~# vim /etc/fstab
Remount everything
root@iemhof:~# mount -a
Disable lv ja
root@iemhof:~# !536 lvchange -an /dev/mapper/iemhof-ja
Remove lv ja
root@iemhof:~# lvremove /dev/iemhof/ja Logical volume "ja" successfully removed
Remove lv vms
root@iemhof:~# lvchange -an /dev/mapper/iemhof-vms root@iemhof:~# lvremove /dev/iemhof/ a root var vb root@iemhof:~# lvremove /dev/iemhof/ a root var vb root@iemhof:~# lvremove /dev/iemhof/vms Logical volume "vms" successfully removed
Remove /dev/sda6 from iemhof
root@iemhof:~# vgreduce iemhof /dev/sda6 Removed "/dev/sda6" from volume group "iemhof"
Recreate lv ja
root@iemhof:~# lvcreate --name ja --size 10G iemhof Logical volume "ja" created.
Create filesystem
root@iemhof:~# mkfs.ext4 /dev/iemhof/ja
mke2fs 1.44.5 (15-Dec-2018)
Discarding device blocks: done
Creating filesystem with 26214400 4k blocks and 6553600 inodes
Filesystem UUID: 3319f0a9-cc02-44e4-b4f5-583ab2a44777
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,
2654208, 4096000, 7962624, 11239424, 20480000, 23887872
Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done
Mount ja to /home/janarie
root@iemhof:~# mount /dev/iemhof/ja /home/janarie/ root@iemhof:~# vim /etc/fstab root@iemhof:~# mount -a
Copy landisplusgyr files back to /home/janarie/landisplusgyr
Start docker container landisplusgyr
root@iemhof:/home/janarie# docker container start 66
Remove Anneke completely, lv etc
Remove samba user
root@iemhof:/home/janarie/landisplusgyr# smbpasswd -x anneke root@iemhof:/home/janarie/landisplusgyr# vim /etc/samba/smb.conf
Unmount anneke
root@iemhof:/home/janarie/landisplusgyr# umount /home/anneke root@iemhof:/home/janarie/landisplusgyr# vim /etc/fstab
Remove user anneke
root@iemhof:/home/janarie/landisplusgyr# deluser anneke --remove-home
Remove lv a
root@iemhof:/home/janarie/landisplusgyr# lvchange -an /dev/mapper/iemhof-a root@iemhof:/home/janarie/landisplusgyr# lvremove /dev/iemhof/a Logical volume "a" successfully removed
Remove VanBerkum
root@iemhof:~# umount /home/vanberkum/ root@iemhof:~# lvchange -an /dev/mapper/iemhof-v iemhof-var iemhof-vb root@iemhof:~# lvchange -an /dev/mapper/iemhof-vb root@iemhof:~# lvremove /dev/iemhof/ ja root var root@iemhof:~# lvremove /dev/mapper/ control iemhof-ja iemhof-root iemhof-var root@iemhof:~# lvremove /dev/mapper/iemhof-vb Logical volume "vb" successfully removed
== Create lv nc-data and mount on /var/nc-data
root@iemhof:~# lvcreate --name nc-data --size 600G iemhof
Logical volume "nc-data" created.
root@iemhof:~# mkdir /var/nc-data
root@iemhof:~# mkfs.ext4 /dev/iemhof/nc-data
mke2fs 1.44.5 (15-Dec-2018)
Discarding device blocks: done
Creating filesystem with 157286400 4k blocks and 39321600 inodes
Filesystem UUID: 5fe9826f-62c0-4a1f-a9e6-020b4012a104
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000
Allocating group tables: done
Writing inode tables: done
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: done
root@iemhof:~# vim /etc/fstab root@iemhof:~# ls /dev/mapper/iemhof- iemhof-ja iemhof-nc--data iemhof-root iemhof-var root@iemhof:~# ls /dev/mapper/iemhof-nc--data root@iemhof:~# vim /etc/fstab root@iemhof:~# ls /var/ backups cache lib local lock log lost+found mail nc-data opt run spool tmp root@iemhof:~# mount -a