Main Menu

Search

HTML - Home - ABOUT TARBOTS


Welcome to tarbots.com
... AI Search Assistant

This site has articles which provides information on everyday commands, procedures & scripts for DevOps & Infrastructure technologies which will be very useful for System Admin, DevOps, CloudOps, Network Admins and any teams or individuals working on Infrastructure technologies.

CLICK HERE to learn more about tarbots.com


Infrastructure Products Covered In This Site

EMOC (2) Exalogic (20) Hardware (4) Infiniband (53) Linux (227) OVM (29) OVS (19) ZFS Storage Appliance (2)

HTML - HOME - RECENT ARTICLES TITLE


Recent Articles

Monday, February 17, 2025

LINUX: How to Connect to Remote Host via Alias Name Using SSH Config File

Following steps for Connecting to Remote Host via Alias Name Using SSH Config File.

All below steps have to be executed on Linux host from which you want to connect to remote server using alias name

NOTE: Please note that below steps can also be applied on MacBook Mac OS terminal as well.

1) create config file inside .ssh folder of user home.

mkdir ~/.ssh/config
2) Edit the ~/.ssh/config file as follows:
Host <alias name>
    HostName <IP/hostname>
    User <username>
    ProxyCommand nc -X connect -x <proxy> %h %p
    ServerAliveInterval <internal>
  • <alias name> with the alias name you want to use to server you want to connect for e.g. testmachine
  • <IP/hostname> with the hostname/ip of remote server for e.g. 10.10.10.10
  • <Username> with the username of the remote server for e.g. appuser
  • <proxy> replace it with the proxy details if any. If no proxy you can remove this line.
  • <internal> with the ServerAliveInterval in seconds. You can skip this flag as well.

There may be other additional SSH settings as well you can place inside config file. Above are just few examples.

3) Now connect to the remote server using alias name as follows. Replace <alias name> with the alias name you set in config file.
ssh <alias name>

Tuesday, February 11, 2025

LINUX: How to Create And Mount New Filesystem With New Extended Storage (Extend Volume / Filesystem / Hard Drive)

Following are steps to Create And Mount New Filesystem With New Extended Storage (Extend Volume / Filesystem / Hard Drive)

STEP 1. Attach the desired size disk to the Linux Machine. 

In this example lets assume we are attaching 200GB disk.

STEP 2. Validate that the 200GB disk is seen on the Linux host. 

For this use fdisk -l command. You should see output as follows:

Disk /dev/sdb: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


STEP 3. Validate that the 200GB added disk is seen in partitions. 

For this run below command.

cat /proc/partitions

From below output we see that it is available as sdb partition

# cat /proc/partitions 
major minor  #blocks  name

   8        0  104857600 sda
   8        1    2048000 sda1
   8        2  102808576 sda2
   8       16  209715200 sdb

 
STEP 4. Now to run fdisk command on /dev/sdb partition to add 200GB size to the Linux host OS.

fdisk /dev/sdb

Below is sample output.

Please enter the entries when prompted as shown in blue bold font below.


# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.32.1).

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.


Device does not contain a recognized partition table.

Created a new DOS disklabel with disk identifier 0xa66f30f6.


Command (m for help): p    >>>>> Enter p here to print partition size details.

Disk /dev/sdb: 200 GiB, 214748364800 bytes, 419430400 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0xa66f30f6


Command (m for help): n >>>>>> Enter n here to create new partition.

Partition type

   p   primary (0 primary, 0 extended, 4 free)

   e   extended (container for logical partitions)

Select (default p):  >>>>>> Just hit Enter and go with defaults


Using default response p.

Partition number (1-4, default 1): >>>>>> Just hit Enter and go with defaults

First sector (2048-419430399, default 2048): >>>>>> Just hit Enter and go with defaults

Last sector, +sectors or +size{K,M,G,T,P} (2048-419430399, default 419430399): >>>>>> Just hit Enter and go with defaults


Created a new partition 1 of type 'Linux' and of size 200 GiB.


Command (m for help): p   >>>>> Enter p here to check the created partition.

Disk /dev/sdb: 200 GiB, 214748364800 bytes, 419430400 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0xa66f30f6


Device     Boot Start       End   Sectors  Size Id Type

/dev/sdb1        2048 419430399 419428352  200G 83 Linux


Command (m for help): w    >>>> Enter w here to write the changes.

The partition table has been altered.

Calling ioctl() to re-read partition table.

Syncing disks.


STEP 5. Format the created partition

For this use below command.

sudo mkfs.xfs -f /dev/sdb

Below is sample output.

meta-data=/dev/sdb               isize=512    agcount=4, agsize=13107200 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1
data     =                       bsize=4096   blocks=52428800, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1
log      =internal log           bsize=4096   blocks=25600, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

STEP 6. Create a directory on which you want to mount the new sdb partition. 

For e.g. lets assume apps

mkdir /apps

STEP 7. Mount newly created /apps partition on sbd partition which has 200GB storage. 

In this example we are having xfs for apps partition, it can be other filesystem type as well other than xfs

sudo mount -t xfs /dev/sdb /apps

STEP 8. Run "df -Th" command and verify that the partition is mounted as /apps mount is mounted with 200GB size. 

Below is snippet.

/dev/sdb            xfs       200G  1.5G  199G   1% /apps


STEP 9. Update /etc/fstab and add below entry to have newly filesystem with /dev/sdb partition.

Update /etc/fstab and add below entry to have newly filesystem with /dev/sdb partition.

/dev/sdb  /apps xfs  defaults  0  0

This is to make sure that filesystem gets automounted during the reboot.

STEP 10. Reboot the node. After the reboot you would notice that the XFS filesystem is auto mounted.

This can be verified using "df -H" command.


Friday, January 31, 2025

LINUX: Command To Check Kernel Max Threads On Linux Host

Below commands can be used to check kernel max threads on Linux

sysctl -a| grep kernel.threads-max
cat /proc/sys/kernel/threads-max

LINUX: Command To List Number of Physical Disks (Drives) On Linux Host

Below command can be used

sudo lshw -class disk -short
Below is sample output
#sudo lshw -class disk -short
H/W path Device Class Description
========================================================
/0/100/1.1/0.0.0 /dev/cdrom disk CD-ROM
/0/100/d/0.0.0 /dev/sda disk 107GB VBOX HARDDISK