Linux
Proxmox + mount a qcow2 disk image
Step 1 – Enable NBD on the Host Step 2 – Connect the QCOW2 as network block device Step 3 – Find The Virtual Machine Partitions Step 4 – Mount the partition from the VM Step 5 – After you done, unmount and disconnect
Extend LVM partition in CentOS 7/8 under VmWare
Add more space on the disk in VmWare console. Run cfdisk and check that you see free space after /dev/sda5. In my case there are /dev/sda4 as extended partition and /dev/sda5 as LVM2 partition in extended. Remember start sectors for /dev/sda4 and sda5. Delete /dev/sda5. Don’t worry – your data will be OK. Delete /dev/sda4. […]
Centos + No more mirrors to try
yum clean all yum –disablerepo=\* –enablerepo=base,extras,updates update
Replace a line in a file with SED
sed -i ‘Ns/.*/replacement-line/’ file.txt where N should be replaced by your target line number. This replaces the line in the original file. To save the changed text in a different file, drop the -i option: sed ‘Ns/.*/replacement-line/’ file.txt > new_file.txt
Extract a text between delimiters with sh instead of using regex
Example file: UNKNOWN[123.21.181.4] abts-tn-dynamic-161.155.174.122.airtelbroadband.in[122.174.155.161] fm-dyn-118-137-18-160.fast.net.id[118.137.18.160] UNKNOWN[118.69.71.76] ip-177.71.93.43.juniornet.psi.br[177.71.93.43] UNKNOWN[210.245.34.254] UNKNOWN[185.140.242.41] I want to extract IP-addresses: command shell: cat drop.txt | cut -d'[‘ -f2 | cut -d’]’ -f1 Get data from the file Delete all the text before the delimeter (we choose the text after the delimiter) Delete alle the text after the delimeter ( … before […]
WGET + Measure for web
wget -E -H -p -Q300K –user-agent=Mozilla –no-cache –no-cookies –no-check-certificate –delete-after –timeout=15 –tries=2 yoursite.com 2>&1 | grep Downloaded
Linux + LVM + fsck
# lvm pvscan # lvm vgscan # lvm vgs # lvm vgchange -a y VolGroup00 # lvm vgdisplay -v VolGroup00 | more # fsck /dev/VolGroup00/LogvolX Can’t find a good superblock backup? To display: # mke2fs -n /dev/VolGroup00/LogVolX Other thoughts: 1. Clean bit could be set – to force an fsck: # fsck -f /dev/vgname/lvolname # […]