Sunday, February 11, 2024
Ext 2 to Ext4 difference
Ext2, Ext3, and Ext4 are three different versions of the extended file system (Ext), which is the default file system for many Linux distributions. Here are the key differences between Ext2, Ext3, and Ext4:
Ext2:
Ext2 was the first version of the extended file system.
It provided basic features for managing files and directories but lacked features such as journaling.
Without journaling, file system consistency in the event of a crash or power failure depended on time-consuming file system checks (fsck) during boot.
It had limitations in terms of maximum file and partition sizes.
Ext3:
Ext3 was developed to address the lack of journaling in Ext2.
It introduced journaling, which improved file system consistency and reduced the need for lengthy fsck operations after crashes or power failures.
With journaling, Ext3 offered faster recovery times and improved reliability compared to Ext2.
Ext3 maintained backward compatibility with Ext2, allowing Ext2 file systems to be upgraded to Ext3 without data loss.
It still had limitations regarding maximum file and partition sizes, though these were improved compared to Ext2.
Ext4:
Ext4 is the latest version of the extended file system and offers several significant improvements over Ext3.
It provides support for larger file systems and files, with maximum file size increased to 16 terabytes and maximum volume size to 1 exabyte.
Ext4 also improves performance through various enhancements such as delayed allocation, extent-based allocation, and multiblock allocation.
It includes support for extents, which replaces the traditional block mapping scheme and reduces metadata overhead for large files.
Ext4 offers faster file system checks (fsck) and better scalability by using multiple block groups concurrently.
It introduced other features like online defragmentation, improved timestamps, and sub-directory scalability.
Ext4 maintains backward compatibility with Ext3 and allows for an in-place upgrade from Ext3 to Ext4 without data migration.
In summary, each version of the extended file system introduced improvements in terms of reliability, performance, scalability, and feature set. Ext4 represents the most advanced version, offering significant enhancements over both Ext2 and Ext3, including support for larger file and partition sizes, improved performance, and new features like extents.
Friday, February 9, 2024
How to upgrade the linux kernel on every month ubuntu/redhat
vi kernel_update.sh
chmod +x kernel_update.sh
#!/bin/bash
# Update package lists
sudo apt update
# Upgrade the Linux kernel
sudo apt upgrade -y linux-image-generic linux-headers-generic
# Reboot the system to apply the new kernel
sudo reboot
crontab -e
0 0 1 * * /home/kernel_update.sh
For Redhat/Centos
vi kernel_update.sh
chmod +x kernel_update.sh
#!/bin/bash
# Update package lists
sudo yum check-update
# Upgrade the Linux kernel
sudo yum update kernel -y
# Reboot the system to apply the new kernel
sudo reboot
crontab -e
0 0 1 * * /home/kernel_update.sh
Note: We can call the script from ansible also every month.
---
- hosts: All
become: yes
tasks:
- name: Kernal upgrade script as Cron job
cron:
user: "root"
day: "1"
hour: "00"
minute: "00"
name: "Kernal upgrade script as Cron job"
job: "/home/kernel_update.sh /tmp/lupdate.log"
How 'ps' command works.
ps command read files from /proc and the content of these files are generated by the kernel.
when you get a "filesystem is full" error, but `df` shows there is free space.
When a filesystem it's out of inode, it can happen when you have a huge amount of small files, in a small filesystem. `df -i` will show.
check the ulmit also once
What is mknod command and when you'd use it.
- mknod command creates a new device in `/dev` but actually udev creates automatically each device, if something very terrible happen we can recreate some devices using mknod to fix or make some backup.
How to force/trigger a file system check on next reboot?
Create a file named forcefsck in the root folder
What is the diference between Telnet and SSH?
- SSH it's encrypted and telnet isn't.
- Telnet can ommit authentication
- SSH adds overhead to the bandwidth
How to redirect STDOUT and STDERR in bash? (> /dev/null 2>&1)
- 1> redirect the STDOUT
- 1>> redirect the STDOUT in append mode
- 2> redirect the STDERR
- 2>> redirect the STDERR in append mode
- &> redirect both STDERR and STDOUT
- &>> redirect both STDERR and STDOUT in append mode
- 2>&1 redirect STDERR to STDOUT
Saturday, January 27, 2024
How to check the iostat on multiple disks in linux
Iostat -x 1 -t sdi sdm sdn sdo sub sda sdl sda sdh sdf sdk
How to collect the sysdump from Mellnox switch
To collect a sysdump:
1. Run the command 'configure terminal'
2. Run the command 'debug generate dump'
3. A file will be created, for example: sysdump-<HOSTNAME>-YYYYMMDD-HHMMSS.tgz
4. Export this file from the switch and share the same
Alternatively, you can generate/collect sysdump files from the GUI by following these steps:
1. Login to the switch via Web GUI (browse to management IP of the switch)
2. Click on the "Status" tab
3. Select "Maintenance" tab
4. You can generate a dump and select a location where to save it.
1. Run the command 'configure terminal'
2. Run the command 'debug generate dump'
3. A file will be created, for example: sysdump-<HOSTNAME>-YYYYMMDD-HHMMSS.tgz
4. Export this file from the switch and share the same
Alternatively, you can generate/collect sysdump files from the GUI by following these steps:
1. Login to the switch via Web GUI (browse to management IP of the switch)
2. Click on the "Status" tab
3. Select "Maintenance" tab
4. You can generate a dump and select a location where to save it.
Linux Performance trouble shooting
Linux Performance trouble shooting
Load Avg 1 min 5 min 15 min
CPU Script to hog the CPU
cpuhog.sh
while true
do yes > /dev/null
done
Disk hog io hog
dd if = /dev/sda of=dev/zero
%us : user space utlizttion started by user/application
%sy : system spce Kernel side utlization
%ni : nice -20 highest 90 is lowesr
%id : idle amount of time CPU is not doing anything
%si : time waiting for the CPU for the IO
%hi : Hardware inturupt
%si : Software inturrupt
%st : Referect stleth used for Virtual System
Cat /proc/interrupt
Load avg ( we will get the info from the following location)
cat /proc/lodavg
cat /proc/slabinfo | grep -i den
cat /proc/meminfo | grep -i slab (Kernel Memory usge )
Buffer consits of metatdata
cat /proc/slabinfo | grep -i den
How to check the dentry size
slabtop | grep -i den
Command to find the kernel Memory
cat /proc/meminfo | grep -i slab (Kernel Memory usge )
Cache app =====> ram (cache) ====> disk
CPU L1/L2/L3 cache =====> Cache====> disk
Command to check the L1 and L2 cache
Shared memory shared by diffrent process
pmap -i
command to free the cache memory (never run the same in the prod box)
sync && echo 3 > /proc/sys/vm/drop_caches (never run the same in the prod box)
to Free page cache dentries and inodes
echo 3
to free dentires and inodes
echo 2
to free page cache
ehco 1
lscpu | grep L1.l2 cache
command to find the which CPU is using for which processor
ps -eo pid,arfs,psr
Command to find the how many CPU are present
cat /proc/cpuinfo | grep -i processor
Saturday, January 13, 2024
How to reset the ipmi config to factory default.
ipmitool raw 0x3c 0x40 for factory reset
ipmitool lan set 1 ipsrc static
ipmitool lan set 1 ipaddr 192.168.0.116
ipmitool lan set 1 netmask 255.255.252.0
ipmitool lan set 1 defgw ipaddr 192.168.0.1
ipmitool lan set 1 arp respond on
ipmitool lan set 1 auth ADMIN MD5
ipmitool lan set 1 access on
Tuesday, December 26, 2023
Ansible script to add the multiple users
---
- name: Add multiple users
hosts: all
vars:
users:
- username: sysadmin
pass: pass1
- username: ansible
pass: pass2
- username: oracle
pass: pass3
tasks:
- name: Add users
user:
name: "{{ item.username }}"
password: "{{ item.pass | password_hash('sha256') }}"
loop: "{{ users }}"
Ansible script to check the user is present in all the hosts.
hosts: all
tasks:
name : Testing Ansible PlayBook
user: name="sysadmin" state=present
Wednesday, December 13, 2023
Wednesday, November 1, 2023
How to add the lun to esxi hosts.
To add a Logical Unit Number (LUN) to VMware ESXi, you can follow these general steps:
- Ensure that the storage device containing the LUN is properly connected and configured in your ESXi environment.
- Log in to the vSphere Client or vSphere Web Client.
- Select the ESXi host on which you want to add the LUN.
- Navigate to the "Configuration" tab and select "Storage" from the hardware list.
- Click on the "Add Storage" button to start the Add Storage wizard.
- In the wizard, choose the storage type appropriate for your setup. This could be Fibre Channel, iSCSI, NFS, or other supported storage types.
- Provide the necessary details based on the storage type you selected. For example, if you choose Fibre Channel, you will need to select the appropriate HBA (Host Bus Adapter) and rescan for new storage devices.
- When prompted to select the LUN, the newly connected LUN should appear in the list of available devices. Select the desired LUN and proceed.
- Configure the datastore settings, such as the datastore name, capacity, and file system version.
- Complete the wizard, review the configuration settings, and click "Finish" to add the LUN to the ESXi host.
ESXi will then recognize and make the LUN available as a datastore that can be used to store virtual machine files, ISO images, and other data within your VMware environment.
It's important to note that the exact steps and options may vary slightly depending on the version of ESXi and the storage technology you are using. Consult the VMware documentation or the vendor's documentation for specific instructions related to your environment.
Thursday, October 19, 2023
Subscribe to:
Posts (Atom)