User Tools

Site Tools


scraps


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scraps [2022/11/19 18:58] millerjsscraps [2025/03/13 13:08] (current) millerjs
Line 9: Line 9:
 uncomment HandPowerKey, set to ignore uncomment HandPowerKey, set to ignore
  
 +===== Get & Set date w/ epoch time =====
 +
 +Get from good machine:
 +
 +<code>date +%s</code>
 +
 +
 +Set on another:
 +<code>date -s '@1705865491'</code>
 ===== Image and Compress Disk ===== ===== Image and Compress Disk =====
 <code> <code>
Line 15: Line 24:
 (-s500G refers to the image size, for estimates) (-s500G refers to the image size, for estimates)
  
 +Mount the whole disk image: (have to un-lz4 first ofc)
 +
 +<code>
 +kpartx -a -v myimage.disk
 +
 +mount /dev/mapper/loop0p1 /mnt/myimage
 +</code>
 +
 +Then, to unmount:
 +
 +<code>
 +umount /mnt/myimage
 +
 +kpartx -d -v myimage.disk
 +</code>
 ===== ntplogtemp ===== ===== ntplogtemp =====
  
Line 27: Line 51:
 </code> </code>
  
-===== Quick Pi ID =====+===== cycle systemd logs ===== 
 +<code>sudo journalctl --rotate ; sudo journalctl --vacuum-time=1s</code> 
 + 
 +==== show systemd logs from boot ==== 
 +<code>sudo journalctl -b</code> 
 + 
 +===== Raspberry Pi ===== 
 +==== Quick Pi ID ====
  
 Easy way to get a quick visual indicator to ID a Pi you're remoted into: Easy way to get a quick visual indicator to ID a Pi you're remoted into:
Line 45: Line 76:
 </code> </code>
  
-===== Raspberry Pi Heartbeat ===== +==== Heartbeat LED ===
 set in config.txt set in config.txt
  
Line 54: Line 84:
 </code> </code>
  
 +==== Grow partition on first boot ====
 +Add to the end of /boot/cmdline.txt
 +
 +<code>
 +quiet init=/usr/lib/raspi-config/init_resize.sh
 +</code>
 ===== chronyc tracking ===== ===== chronyc tracking =====
  
Line 137: Line 173:
 </code> </code>
  
 +===== Build LinuxPTP on Alpine =====
 +Enable community repository 
  
 +install deps
 +<code>apk add alpine-sdk linux-headers bsd-compat-headers </code>
 +
 +<code>git clone git://git.code.sf.net/p/linuxptp/code linuxptp</code>
 +
 +<code>make ; make install</code>
 +
 +===== Cycle Chrony Logs =====
 +<code>
 +#!/bin/bash
 +# chrony log rotation
 +
 +cd /var/log/chrony
 +
 +mv measurements.log measurements.$(date +"%Y%m%d").log
 +mv statistics.log statistics.$(date +"%Y%m%d").log
 +mv tracking.log tracking.$(date +"%Y%m%d").log
 +
 +sync
 +
 +chronyc cyclelogs
 +</code>
 +
 +===== chrony.conf ptp as pps refclock =====
 +<code>
 +server time-a.nist.gov
 +server time-a-wwv.nist.gov
 +
 +refclock SHM 0 poll 3 refid GPS
 +refclock PHC /dev/ptp0:extpps:nocrossts:pin=0 width 0.1 refid PHC pps
 +
 +logdir /var/log/chrony
 +log statistics tracking measurements
 +
 +driftfile /var/lib/chrony/chrony.drift
 +
 +dumpdir /etc/chrony/dump
 +
 +rtcsync
 +
 +allow
 +cmdallow
 +</code>
 +
 +===== Set NIC to promiscuous mode at boot =====
 +Using systemd:
 +
 +`/etc/systemd/system/promisc-eth0.service`
 +
 +<code>
 +[Unit]
 +Description=Control promiscuous mode for interface eth0
 +After=network.target
 +
 +[Service]
 +Type=oneshot
 +ExecStart=/usr/bin/ip link set eth0 promisc on
 +ExecStop=/usr/bin/ip link set eth0 promisc off
 +RemainAfterExit=yes
 +
 +[Install]
 +WantedBy=multi-user.target
 +</code>
 +
 +===== Proxmox =====
 +==== re-number VM ====
 +
 +1) shut down VM
 +2) rename the storage
 +<code>zfs rename pool1/vms/vm-112-disk-0 pool1/vms/vm-1001-disk-0</code>
 +3) rename the configuration file
 +<code>
 +export vgNAME=vg-images newVMID=173 oldVMID=175 ;  \
 +sed -i "s/$oldVMID/$newVMID/g" /etc/pve/qemu-server/$oldVMID.conf; mv /etc/pve/qemu-server/$oldVMID.conf /etc/pve/qemu-server/$newVMID.conf; \
 +unset vgNAME newVMID oldVMID;
 +</code>
scraps.1668884333.txt.gz · Last modified: 2024/11/14 02:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki