Skip to main content

Linux tips

Example ports and hosts used, change to your own setup.

check if ports are open

nc -vz 30333

see cpu frequencies

lscpu --all --extended

get more disk space by limiting reserved space for root

Default is 5% which is 50GB on a 1000 GB system, 0.1 (1GB) is more suitable.

tune2fs -m0.1 /dev/<disk>

get disk space information

du -sh /home/polkadot/*
df -h


curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_rotateKeys", "params":[]}' http://localhost:9944 > session.key

check session keys

curl -H "Content-Type: application/json" -d '{"id":1, "jsonrpc":"2.0", "method": "author_hasSessionKeys", "params":["<session key 0x.....>"]}' http://localhost:9944

see number of processes at a certain port

netstat -tn src :30333 | wc -l

convert raid1 to raid0

Sometimes you want to combine two raid disk to one, gaining space but sacrificing redundancy. Only do this with non vital data. See also After the --level=0 command raid will switch to raid 4 and after rebuilding to raid 0. Sometimes you have two wait between command for the rebuild to finish.

mdadm --detail /dev/md1
mdadm /dev/md1 --grow --level=0
mdadm /dev/md1 --grow --raid-devices=2 --add /dev/sdb1
fdisk /dev/md1
growpart /dev/md1 1
resize2fs /dev/md1p1