User Tools

Site Tools



en:linux:start

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
en:linux:start [2022/10/15 12:52] – [NTP] franken:linux:start [2024/04/07 19:40] (current) – [LVM] frank
Line 85: Line 85:
   ps -o pid,args -C tcpdump   ps -o pid,args -C tcpdump
  
 +===== ls =====
 +
 +full timestamps:
 +
 +  ls -l --time-style="+%Y-%m-%d %H:%M"
 +
 +deactivate colors:
 +
 +  ls -l --color=none
 +
 +===== bashrc / alias =====
 +
 +  alias cp="rsync -av --partial --progress"
 +  alias pynano="nano -ET4"
 +  alias catconf='find . -type f -exec grep -Iq . {} \; -printf "\n\n%p:\n" -exec cat {} \;'
 ===== nano ===== ===== nano =====
  
Line 120: Line 135:
   sudo badblocks -nsv /dev/sdb   sudo badblocks -nsv /dev/sdb
  
 +http://www.das-werkstatt.com/forum/werkstatt/viewtopic.php?t=2346
 ====== NTP ====== ====== NTP ======
  
Line 125: Line 141:
   #nano /etc/ntp.conf # need restart after change   #nano /etc/ntp.conf # need restart after change
   service ntp status   service ntp status
 +  #show state of servers
 +  ntpq -p
  
 manual update: manual update:
Line 144: Line 162:
   sudo update-alternatives --config arm-linux-gnueabihf-gcc   sudo update-alternatives --config arm-linux-gnueabihf-gcc
   arm-linux-gnueabihf-gcc --version   arm-linux-gnueabihf-gcc --version
 +
 +  #to create update-alternatives in a loop you can use this
 +  for i in $(ls /usr/bin/arm-linux-gnueabihf-gcc-{9..12});do sudo update-alternatives --install /usr/bin/arm-linux-gnueabihf-gcc arm-linux-gnueabihf-gcc $i 50;done
  
 other example other example
Line 154: Line 175:
   mv /home/frank/test{,.bak}   mv /home/frank/test{,.bak}
  
 +====== gunzip ======
 +
 +on-the-fly decompress and write to disk
 +
 +  gunzip -c bpi-r3_sdmmc_bullseye.img.gz | sudo dd bs=1M status=progress conv=notrunc,fsync of=/dev/sdX
 +
 +====== tar ======
 +
 +  tar -xzf file.tar.gz --strip-components 1 -C DESTINATION
 +
 +====== sed ======
 +
 +extract text between patterns:
 +
 +https://stackoverflow.com/questions/38972736/how-to-print-lines-between-two-patterns-inclusive-or-exclusive-in-sed-awk-or
 +
 +example (extract frequencies from iw command):
  
 +  iw list | sed -n '/Frequencies/,/Band\|Supported commands/{/Band\|Supported commands/!p;}'
 ====== irssi ====== ====== irssi ======
  
Line 223: Line 262:
 SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="tty_r2" SUBSYSTEM=="tty", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", ATTRS{serial}=="0001", SYMLINK+="tty_r2"
 </code> </code>
 +
 +this udev rules i use for ftdi 4xuart adapter (FT4232H Quad RS232-HS)
 +<code>
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="00", SYMLINK+="ftdi_r2"
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="01", SYMLINK+="ftdi_r64"
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="02", SYMLINK+="ftdi_r3"
 +SUBSYSTEM=="tty", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6011", ENV{ID_USB_INTERFACE_NUM}=="03", SYMLINK+="ftdi_r4"
 +</code>
 +
 +easier way to get the main-properties of a device
 +
 +  udevadm info /dev/sdb1
 ====== sshd ====== ====== sshd ======
 ===== qnap (entware) ===== ===== qnap (entware) =====
Line 259: Line 310:
   fsck.mode=force   fsck.mode=force
  
 +===== smartctl / hdparm =====
 +
 +<code>
 +smartctl -t short /dev/sdb
 +smartctl -a /dev/sdb | grep -A1 "Self-test execution status"
 +#Beispielausgabe:
 +Self-test execution status:      ( 249) Self-test routine in progress...
 + 90% of test remaining.
 +#oder:
 +Self-test execution status:      ( 121) The previous self-test completed having
 + the read element of the test failed.
 +
 +#warten bis fertig und bei Fehler:
 +smartctl -a /dev/sdb | grep '^#'
 +Beispielausgabe mit Fehler (long):
 +# 1  Extended offline    Completed: read failure       90%       267         1709921
 +
 +#sektor und angrenzende in Schleife versuchen neu zu schreiben
 +for i in {1709920..1709930};do hdparm --yes-i-know-what-i-am-doing --repair-sector $i /dev/sdb;sleep 1;done
 +</code>
 +
 +===== iostat =====
 +
 +  apt install sysstat
 +  
 +Ausgabe:
 +
 +<code>$ iostat -m -p /dev/sdb
 +Linux 5.15.0-56-generic (frank-G5) 29.12.2022 _x86_64_ (12 CPU)
 +
 +avg-cpu:  %user   %nice %system %iowait  %steal   %idle
 +           2,19    0,01    0,74    2,58    0,00   94,48
 +
 +Device             tps    MB_read/   MB_wrtn/   MB_dscd/   MB_read    MB_wrtn    MB_dscd
 +sdb               5,80         0,00         0,67         0,00          3       9123          0
 +sdb1              0,01         0,00         0,00         0,00          2          0          0
 +</code>
 ===== rc.local ===== ===== rc.local =====
  
Line 318: Line 406:
  
 Solution using /etc/default/locale was not working for me Solution using /etc/default/locale was not working for me
 +
 +===== LVM =====
 +https://wiki.debian.org/LVM#Create_a_PV
 +
 +prepared initrd
 +<code>
 +  apt install initramfs-tools
 +  kernelversion=$(uname -r)
 +  echo $kernelversion
 +  zcat /proc/config.gz > /boot/config-$kernelversion
 +  less /boot/config-$kernelversion
 +  update-initramfs -k $kernelversion -c
 +</code>
 +
 +<code>
 +root@bpi-r3-mini:~# apt install lvm2
 +root@bpi-r3-mini:~# fdisk /dev/nvme0n1
 +#changed type of partition 3 to lvm
 +root@bpi-r3-mini:~# pvcreate /dev/nvme0n1p3
 +root@bpi-r3-mini:~# vgcreate vg-nvme /dev/nvme0n1p3                             
 +  Volume group "vg-nvme" successfully created
 +root@bpi-r3-mini:~# vgdisplay
 +  --- Volume group ---
 +  VG Name               vg-nvme
 +  System ID             
 +  Format                lvm2
 +  Metadata Areas        1
 +  Metadata Sequence No  1
 +  VG Access             read/write
 +  VG Status             resizable
 +  MAX LV                0
 +  Cur LV                0
 +  Open LV               0
 +  Max PV                0
 +  Cur PV                1
 +  Act PV                1
 +  VG Size               80.74 GiB                                               
 +  PE Size               4.00 MiB                                                
 +  Total PE              20670                                                   
 +  Alloc PE / Size       0 / 0                                                   
 +  Free  PE / Size       20670 / 80.74 GiB                                       
 +  VG UUID               w22Wdx-Fhch-YNsA-roWh-Zq81-qv0R-d5fnvw                  
 +                                                                                
 +root@bpi-r3-mini:~# lvcreate -n var -L 10g vg-nvme                              
 +  Logical volume "var" created.
 +root@bpi-r3-mini:~# mkfs -t ext4 /dev/vg-nvme/var
 +root@bpi-r3-mini:~# mount /dev/mapper/vg--nvme-var /var_lvm
 +[ 5279.856899] EXT4-fs (dm-0): mounted filesystem 520d434d-fdfc-48f3-823d-77e602
 +7e84e7 r/w with ordered data mode. Quota mode: disabled.
 +root@bpi-r3-mini:~#
 +</code>
 +
en/linux/start.1665831128.txt.gz · Last modified: 2023/06/08 17:06 (external edit)