diff options
Diffstat (limited to '3 Resources/Linux')
-rw-r--r-- | 3 Resources/Linux/BatchMode.md | 6 | ||||
-rw-r--r-- | 3 Resources/Linux/Create bootable USB.md | 8 | ||||
-rw-r--r-- | 3 Resources/Linux/Device mapper.md | 1 | ||||
-rw-r--r-- | 3 Resources/Linux/Exit SSH control master connection.md | 6 | ||||
-rw-r--r-- | 3 Resources/Linux/FS/Tmpfs.md (renamed from 3 Resources/Linux/filesystems/Tmpfs.md) | 0 | ||||
-rw-r--r-- | 3 Resources/Linux/FS/Writeback cache.md | 36 | ||||
-rw-r--r-- | 3 Resources/Linux/FS/physical_write_cache.png | bin | 0 -> 32969 bytes | |||
-rw-r--r-- | 3 Resources/Linux/FS/vm_write_cache.png | bin | 0 -> 40616 bytes | |||
-rw-r--r-- | 3 Resources/Linux/Grepping stuff.md | 15 | ||||
-rw-r--r-- | 3 Resources/Linux/NetworkManager.md | 43 | ||||
-rw-r--r-- | 3 Resources/Linux/Use type if which doesnt work.md | 7 | ||||
-rw-r--r-- | 3 Resources/Linux/Useful info about Debian packages.md | 9 | ||||
-rw-r--r-- | 3 Resources/Linux/Using GRUB we need an EF02 partition.md | 13 |
13 files changed, 143 insertions, 1 deletions
diff --git a/3 Resources/Linux/BatchMode.md b/3 Resources/Linux/BatchMode.md new file mode 100644 index 0000000..e45de5a --- /dev/null +++ b/3 Resources/Linux/BatchMode.md @@ -0,0 +1,6 @@ +--- +tags: + - ssh + - linux +--- +With BatchMode if SSH will fail instantly if the key is rejected, rather than prompting for a password and causing scripts to hang indefinitely.
\ No newline at end of file diff --git a/3 Resources/Linux/Create bootable USB.md b/3 Resources/Linux/Create bootable USB.md new file mode 100644 index 0000000..a296677 --- /dev/null +++ b/3 Resources/Linux/Create bootable USB.md @@ -0,0 +1,8 @@ +--- +tags: + - linux + - bootable +--- +``` +sudo dd bs=4M conv=fsync oflag=direct status=progress if=linux.iso of=/dev/sda +```
\ No newline at end of file diff --git a/3 Resources/Linux/Device mapper.md b/3 Resources/Linux/Device mapper.md index 059a0d1..27980ca 100644 --- a/3 Resources/Linux/Device mapper.md +++ b/3 Resources/Linux/Device mapper.md @@ -4,7 +4,6 @@ Device mapper is a kernel driver to map physical block devices to virtual ones; this means that for example we can have many physical devices be represented by a single virtual one (linear mapping). How does it work? -[[1 projects/Inwerken Mohammed/TODO]] What is its function in relation to multipath? Logical devices using device-mapper can be managed using `man 8 dmsetup` diff --git a/3 Resources/Linux/Exit SSH control master connection.md b/3 Resources/Linux/Exit SSH control master connection.md new file mode 100644 index 0000000..7054d9d --- /dev/null +++ b/3 Resources/Linux/Exit SSH control master connection.md @@ -0,0 +1,6 @@ +--- +tags: + - ssh + - linux +--- +To exit an existing session use `ssh -O exit <user>@<host>`
\ No newline at end of file diff --git a/3 Resources/Linux/filesystems/Tmpfs.md b/3 Resources/Linux/FS/Tmpfs.md index b8fe839..b8fe839 100644 --- a/3 Resources/Linux/filesystems/Tmpfs.md +++ b/3 Resources/Linux/FS/Tmpfs.md diff --git a/3 Resources/Linux/FS/Writeback cache.md b/3 Resources/Linux/FS/Writeback cache.md new file mode 100644 index 0000000..03917bb --- /dev/null +++ b/3 Resources/Linux/FS/Writeback cache.md @@ -0,0 +1,36 @@ +--- +tags: + - linux + - qemu + - filesystem +references: + - https://avidandrew.com/understanding-disk-cache-writeback-ext4.html + - https://docs.kernel.org/admin-guide/sysctl/vm.html#dirty-expire-centisecs +--- +normal: write() -> cache (multiple layers) -> disk + +# Physical server write cache +![[physical_write_cache.png]] + +Page cache -> RAM + +Journal -> ensures data is fully written before the transaction is considered complete. +`commit` mount option -> flushes cache to disk every x seconds (configurable), ==default = 5.== +`barrier` mount option -> enables the ordering of groups of writes, controller ensures writes before barrier are written before writes after barrier. ==Default = 1== + +`commit` + dirty_expire_centisecs [2] ~ automatic persisting of data. + +If we call `sync`, `fsync` or `fdatasync` ourselves our data is forced on-disk right away by the kernel, no need to wait for commit + dirty_expirty_centisecs. + +# VM Write cache + Guest has its own page cache + ![[vm_write_cache.png]] + +QEMU/KVM options for disk caches: +- Writeback -> write complete if in host page cache; guest required to flush for integrity. +- Writethrough -> write complete if committed to disk; guest no need to flush. +- None -> Equivalent to direct access to host disk. Guest needs to flush. +- Unsafe -> eq writeback but flush ignored. Performance. +- Directsync -> writethrough but without host page cache. + +Safe if guest uses `commit` and `barrier` and therefore `fdatasync` syscalls on a recurring basis.
\ No newline at end of file diff --git a/3 Resources/Linux/FS/physical_write_cache.png b/3 Resources/Linux/FS/physical_write_cache.png Binary files differnew file mode 100644 index 0000000..819c834 --- /dev/null +++ b/3 Resources/Linux/FS/physical_write_cache.png diff --git a/3 Resources/Linux/FS/vm_write_cache.png b/3 Resources/Linux/FS/vm_write_cache.png Binary files differnew file mode 100644 index 0000000..1c63843 --- /dev/null +++ b/3 Resources/Linux/FS/vm_write_cache.png diff --git a/3 Resources/Linux/Grepping stuff.md b/3 Resources/Linux/Grepping stuff.md new file mode 100644 index 0000000..2d6af44 --- /dev/null +++ b/3 Resources/Linux/Grepping stuff.md @@ -0,0 +1,15 @@ +--- +tags: + - grep + - ripgrep + - linux +--- +# Grep +`grep -vxf gobs_servers onecrm_servers` grep all onecrm_servers that **ARE NOT** in gobs_servers +`grep -oxf gobs_servers onecrm_servers` grep all onecrm_servers that **ARE** in gobs_servers +`grep -vxf onecrm_servers gobs_servers` grep all gobs_servers that **ARE NOT** in onecrm_servers +`grep -oxf onecrm_servers gobs_servers` grep all gobs_servers that **ARE** in onecrm_servers +# Ripgrep +Pass `-L` to `rg` to make it follow symlinks: this is handy for example when searching hieradata, because node definitions can be symlinked. + + `-l` for showing only files with matches
\ No newline at end of file diff --git a/3 Resources/Linux/NetworkManager.md b/3 Resources/Linux/NetworkManager.md new file mode 100644 index 0000000..545124c --- /dev/null +++ b/3 Resources/Linux/NetworkManager.md @@ -0,0 +1,43 @@ +--- +tags: + - linux + - networking +references: + - https://networkmanager.dev/ + - https://ubuntu.com/core/docs/networkmanager/configure-vpn + - https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/assembly_networkmanager-connection-profiles-in-keyfile-format_configuring-and-managing-networking +--- +Connection profiles (nm-settings-nmcli(5)) +Networkmanager will only read profile files owned by root bc they often contain secrets. +Keyfile format for connection profiles is .INI-like, but makes it possible for example to write a list of arrays in a space-seperated string? + + +> Configuring secrets for when using OpenVPN together with NetworkManager in NixOS is complete dogshit. Avoid :) + +Manually defining VPN +https://networkmanager.dev/docs/api/latest/nm-settings-nmcli.html +``` +nmcli c add connection.id vpntest connection.type vpn \ + vpn.service-type org.freedesktop.NetworkManager.openvpn \ + ipv4.never-default true \ + ipv6.never-default true \ + +vpn.data ca=/sjj:qvar/snap/network-manager/common/creds/server_ca.crt \ + +vpn.data cert=/var/snap/network-manager/common/creds/user.crt \ + +vpn.data cert-pass-flags=0 \ + +vpn.data cipher=AES-128-CBC \ + +vpn.data comp-lzo=adaptive \ + +vpn.data connection-type=tls \ + +vpn.data dev=tun \ + +vpn.data key=/var/snap/network-manager/common/creds/user.key \ + +vpn.data ping=10 \ + +vpn.data ping-restart=60 \ + +vpn.data remote=<server>:<port> \ + +vpn.data remote-cert-tls=server \ + +vpn.data ta=/var/snap/network-manager/common/creds/tls_auth.key \ + +vpn.data ta-dir=1 \ + +vpn.data verify-x509-name=name:access.is +``` + + +Conver nmconnection into Nix +https://github.com/janik-haag/nm2nix
\ No newline at end of file diff --git a/3 Resources/Linux/Use type if which doesnt work.md b/3 Resources/Linux/Use type if which doesnt work.md new file mode 100644 index 0000000..39881dc --- /dev/null +++ b/3 Resources/Linux/Use type if which doesnt work.md @@ -0,0 +1,7 @@ +--- +tags: + - linux + - shell +--- +Sometimes `which` will say: HEY it's a function! +Then we can use `type` :) It even shows the defition!
\ No newline at end of file diff --git a/3 Resources/Linux/Useful info about Debian packages.md b/3 Resources/Linux/Useful info about Debian packages.md new file mode 100644 index 0000000..f401790 --- /dev/null +++ b/3 Resources/Linux/Useful info about Debian packages.md @@ -0,0 +1,9 @@ +--- +tags: + - debian + - packaging + - linux +--- +https://www.debian.org/doc/debian-policy/index.html + +Specifically https://www.debian.org/doc/debian-policy/ch-relationships.html
\ No newline at end of file diff --git a/3 Resources/Linux/Using GRUB we need an EF02 partition.md b/3 Resources/Linux/Using GRUB we need an EF02 partition.md new file mode 100644 index 0000000..8fd3109 --- /dev/null +++ b/3 Resources/Linux/Using GRUB we need an EF02 partition.md @@ -0,0 +1,13 @@ +--- +tags: + - linux + - grub +--- +I've learnt that to install GRUB we need an EF02 partition as the first partition. + +MBR -> first sector of disk contains boot loader +GPT -> a seperate partition + +EF00 -> EFI System Partition (ESP) +EF02 -> BIOS boot partition +Both are partitions for GPT partitioned disks, just the type of firmware is different,.
\ No newline at end of file |