Friday, October 30, 2020

Check the open files limit and current for a process

> for p in $(pidof java); do printf "$p: "; ls -l /proc/$p/fd |wc -l; done
54055: 93
54008: 9


> for p in $(pidof java); do printf "$p: "; cat /proc/$p/limits |grep open; done
54055: Max open files            65536                65536                files
54008: Max open files            65536                65536                files

Friday, October 9, 2020

Compiler flags

want to find compiler flags supported by your CPU?

gcc -v -E -x c /dev/null -o /dev/null -march=native 2>&1 | grep /cc1

Saturday, August 8, 2020

LVM Raid10 on 4 HD with SSD cache

sdc/sdd are SSD, sde through sdh are 3TB HDD

vgcreate data_sata1 /dev/sdc /dev/sdd /dev/sde /dev/sdf /dev/sdg /dev/sdh


lvcreate --type raid10 -m 1 -i 2 --stripesize 1024k -l100%free -n plots data_sata1 /dev/sde /dev/sdf /dev/sdg /dev/sdh


lvcreate --type raid1 -m 1 -l 100%free -n cache data_sata1 /dev/sdc /dev/sdd

lvconvert --type cache --cachevol cache --cachemode writeback --chunksize 1024 data_sata1/plots

mkfs.xfs /dev/mapper/data_sata1-plots

Wednesday, July 29, 2020

LVM Looking up stripes and stripesize of logical volumes

lvs -o+lv_layout,stripes,stripesize
  LV    VG            Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert Layout     #Str Stripe
  data  fedora_node-2 -wi-ao---- 400.00g                                                     linear        1     0
  data  fedora_node-2 -wi-ao---- 400.00g                                                     linear        1     0
  root  fedora_node-2 -wi-ao---- <33.45g                                                     linear        1     0
  root  fedora_node-2 -wi-ao---- <33.45g                                                     linear        1     0
  swap  fedora_node-2 -wi-ao----  15.73g                                                     linear        1     0
  plots scratch_nvme1 rwi-aor---  <1.82t                                                     raid,raid0    2  1.00m
  plots scratch_sata1 rwi-aor---   2.91t                                                     raid,raid0    4  1.00m
  plots scratch_sata2 rwi-aor---  <1.46t                                                     raid,raid0    4  1.00m

Tuesday, June 23, 2020

Test if a mounted drive works with timeout

timeout -k 10s -s SIGKILL 10 touch /mnt/disk1/foo

> this worked well with a stale NFS mount, yet need to test if works also with "hung" SATA/USB drive etc.

Find out to which HBA disks are connected to


[root@node-2d current]# udevadm info --query=path --name /dev/sdd
/devices/pci0000:00/0000:00:03.2/0000:10:00.0/host10/port-10:0/end_device-10:0/target10:0:0/10:0:0:0/block/sdd

[root@node-2d current]# lspci -v -s 10:00.0
10:00.0 Serial Attached SCSI controller: Broadcom / LSI SAS3008 PCI-Express Fusion-MPT SAS-3 (rev 02)
        Subsystem: Broadcom / LSI SAS9300-8i
        Flags: bus master, fast devsel, latency 0, IRQ 152
        I/O ports at d000 [size=256]
        Memory at f6e40000 (64-bit, non-prefetchable) [size=64K]
        Memory at f6e00000 (64-bit, non-prefetchable) [size=256K]
        Expansion ROM at f6d00000 [disabled] [size=1M]
        Capabilities: [50] Power Management version 3
        Capabilities: [68] Express Endpoint, MSI 00
        Capabilities: [a8] MSI: Enable- Count=1/1 Maskable+ 64bit+
        Capabilities: [c0] MSI-X: Enable+ Count=96 Masked-
        Capabilities: [100] Advanced Error Reporting
        Capabilities: [1e0] Secondary PCI Express
        Capabilities: [1c0] Power Budgeting <?>
        Capabilities: [190] Dynamic Power Allocation <?>
        Capabilities: [148] Alternative Routing-ID Interpretation (ARI)
        Kernel driver in use: mpt3sas
        Kernel modules: mpt3sas


[root@node-2d current]# udevadm info --query=path --name /dev/sdc
/devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:0a.0/0000:0e:00.0/ata8/host7/target7:0:0/7:0:0:0/block/sdc


[root@node-2d current]# lspci -v -s 02:00.0
02:00.0 PCI bridge: Advanced Micro Devices, Inc. [AMD] Matisse Switch Upstream (prog-if 00 [Normal decode])
        Flags: bus master, fast devsel, latency 0, IRQ 24
        Bus: primary=02, secondary=03, subordinate=0e, sec-latency=0
        I/O behind bridge: 0000f000-0000ffff [size=4K]
        Memory behind bridge: f6200000-f69fffff [size=8M]
        Prefetchable memory behind bridge: 00000000f2400000-00000000f2cfffff [size=9M]
        Capabilities: [50] Power Management version 3
        Capabilities: [58] Express Upstream Port, MSI 00
        Capabilities: [a0] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
        Capabilities: [270] Secondary PCI Express
        Capabilities: [370] L1 PM Substates
        Capabilities: [400] Data Link Feature <?>
        Capabilities: [410] Physical Layer 16.0 GT/s <?>
        Capabilities: [440] Lane Margining at the Receiver <?>
        Kernel driver in use: pcieport


Resources:

Thursday, May 28, 2020

Wipe a signature from a device

wipefs -a /dev/sda

Checking on how many USB root hosts exists in Nvidia Jetson Nano B01

root@jnode-1:~# lsusb -t

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
        |__ Port 1: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 2: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
        |__ Port 4: Dev 5, If 0, Class=Mass Storage, Driver=uas, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=tegra-xusb/5p, 480M
    |__ Port 2: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M

Monday, May 25, 2020

Python 3.8 on Centos7

> yum -y groupinstall "Development Tools"
> yum -y install openssl-devel bzip2-devel libffi-devel wget

> cd /opt
> wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz

> tar xvf Python-3.8.3.tgz
> cd Python-3.8.3/

> ./configure --enable-optimizations
> make altinstall

> python3.8 --version
Python 3.8.3

Thursday, May 21, 2020

Dependencies to compile 32 bit app on 64 bit Linux

yum -y install glibc-devel.i686 glibc-devel libstdc++-devel.i686

NTP service to keep time in sync

yum install ntp ntpdate ntp-doc -y
ntpdate europe.pool.ntp.org
systemctl start ntpd
systemctl enable ntpd