Ever wondered how to convert your old MBR based instances to new GPT ones? This will help you to have larger boot volumes and lots of other benefits.
Wednesday, August 30, 2023
MBR to GPT Disk conversion on Linux
How to analyse FIO output
Storage performance testing plays a vital role in understanding the capabilities of your storage system. When using tools like Fio (Flexible I/O Tester) to evaluate performance, analyzing the generated output is crucial. This guide will walk you through the process of analyzing Fio output to gain insights into your storage system's performance.
Step 1: Run Fio Test:
Begin by running the Fio test using your desired configuration file. For instance, if your configuration file is named random-read.fio
, execute the following command:
fio random-read.fio
Step 2: Understand the Output: Fio provides both human-readable and machine-readable output. While the human-readable output is displayed in the terminal during testing, the machine-readable output is saved in a JSON file. This JSON output is well-suited for detailed analysis.
Step 3: Parsing JSON Output:
To extract specific metrics from the JSON output, tools like jq
can be helpful. For instance, to retrieve the mean IOPS of read operations, use:
fio random-read.fio --output=result.json
jq '.jobs[0].read.iops_mean' result.json
Step 4: Metrics to Analyze: Key metrics to analyze include:
iops
: Input/Output Operations Per Second.bw
: Bandwidth in bytes per second.lat
: Latency metrics, such aslat_ns
for nanosecond latency.slat
,clat
, and latency percentiles: These provide insights into different latency components.
Step 5: Graphing and Visualization: Visualizing metrics over time using tools like Excel or Gnuplot can reveal performance trends. This helps identify potential bottlenecks or improvements in your storage system.
Step 6: Comparing Tests: When conducting multiple tests with varying configurations, comparing their outputs can highlight performance differences. This aids in pinpointing optimization opportunities.
Step 7: Experimentation and Iteration: Fio offers numerous configuration options. Experiment with different settings to understand how your storage system behaves under various workloads.
In conclusion, effectively analyzing Fio output involves running tests, extracting relevant metrics, visualizing data, and making informed decisions based on your storage system's behavior. By following these steps, you can unlock valuable insights into your storage system's performance and make informed decisions about optimizations and configurations.
Create Desktop Environment in Suse Linux on AWS
Having a Desktop environment on a Cloud Instance is helpful in many ways. You can troubleshoot application connectivity, take proper HAR files and so on. Even having a desktop is cool!
Here is how you can install GNOME on any SUSE Linux instances in any Cloud Environments. Remember, once you install GNOME (or KDE or any desktop environment as a matter of fact), you need to use VNC to connect to it.
The same steps can be used on any Cloud environments like Oracle Cloud (OCI), AWS, Azure, GCP and so on.
How to create 1000s of small files in Linux for troubleshooting
How to do faster copy and delete operations on EFS file systems
Issue: How to do faster copy and delete operations on EFS file systems.
Environment:
Amazon Linux
Ubuntu Server
Amazon EFS
Solution:
To optimize copy and delete operations on EFS file systems, you can use the GNU Parallel shell tool for executing jobs in parallel. By doing this you will be able to complete these tasks faster than using the normal serial method.
1.a. Install the NFS utilities and the GNU parallel package on Amazon Linux.
[ec2-user ~]$ sudo yum install nfs-utils -y
[ec2-user ~]$ sudo yum install parallel
1.b. Install the NFS utilities and the GNU parallel package on Ubuntu Server.
[ubuntu ~]$ sudo apt-get install nfs-common parallel -y
1.c. Install from source:
[ec2-user ~]$ cd /tmp; wget http://ftp.gnu.org/gnu/parallel/parallel-latest.tar.bz2
[ec2-user ~]$ tar -xvf parallel-20120122.tar.bz2; cd parallel-20170822
[ec2-user ~]$ sudo yum groupinstall 'development tools' -y
[ec2-user ~]$ make; ./configure && sudo make install
2. Create a temporary directory and mount the EFS filesystem.
[ec2-user ~]$ sudo mkdir /mnt/efs; sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 fs-XXXXXXXX.efs.REGION.amazonaws.com:/ /mnt/efs
3. Create ten thousand small files local in your instance.
[ec2-user ~]$ mkdir /tmp/efs; for each in $(seq 1 10000); do SUFFIX=$(mktemp -u _XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX); sudo dd if=/dev/zero of=/tmp/efs/${SUFFIX} bs=64k count=1; done
4. Copy the files from your instance to the EFS file system using the parallel method.
[ec2-user ~]$ cd /tmp/efs; find -L . -maxdepth 1 -type f | sudo parallel rsync -avR {} /mnt/efs/
5. Delete the files from the EFS file system using the parallel method.
[ec2-user ~]$ cd /mnt/efs; find -L . -maxdepth 1 -type f | sudo parallel rm -rfv {}
Test:
The following output is from my tests, using an EFS file system (General Purpose) mounted on a t2.micro instance type:
1. Copy ten thousand files from my EC2 instance to my EFS file system, using the normal serial method.
[ec2-user ~]$ cd /tmp/efs; time sudo find -L . -maxdepth 1 -type f -exec rsync -avR '{}' /mnt/efs/ \;
real 20m8.947s
user 0m0.060s
sys 0m0.980s
2. Copy ten thousand files from my EC2 instance to my EFS file system, using the parallel method.
[ec2-user ~]$ cd /tmp/efs; time find -L . -maxdepth 1 -type f | sudo parallel rsync -avR {} /mnt/efs/
real 5m34.264s
user 0m8.308s
sys 0m6.904s
3. Delete ten thousand files from my EFS file system, using the normal serial method.
[ec2-user ~]$ cd /mnt/efs; time sudo find -L . -maxdepth 1 -exec rm -rfv {} \;
real 2m24.799s
user 0m0.124s
sys 0m1.240s
4. Delete ten thousand files from my EFS file system, using the parallel method.
[ec2-user ~]$ cd /mnt/efs; find -L . -maxdepth 1 -type f | sudo parallel rm -rfv {}
real 1m55.153s
user 0m7.988s
sys 0m6.972s
Recursively copy :
To add to this amazing article as most us are using this as a sample for our customers I would like to mention that the examples above will copy all files from SRC only, not recursively into /SRC. If you need recursively copy you will have two option with rsync:
Loop:
find /SRC/ -type d | while read -r c; do cd "$c"; find -L . -maxdepth 1 -type f | parallel rsync --avR {} /DST; done
As the above allows you the possibility to run parallel copy and recursively copy the data from SRC/ to DST it also introduces a performance penalty as the loop have to read to each folder recursively and fire parallel copies only of the content of that location.
List Creation:
Create List
rsync -avR --dry-run /SRC /DST > lsit.log
Run the command:
cat list.log | parallel --will-cite -j 100 rsync -avR {} /DST/
The above is a much simpler approach, what basically do is to create a list of all files/folders recursively on /SRC and fire 100 parallel copies reading the path of the files to copy from the list. This allows the copies to be much more efficient as having less over the head.
[2] http://www.gnu.org/software/parallel/man.html#EXAMPLE:-Parallelizing-rsync
Block Volume Performance calculation
In the realm of modern computing, where data storage and retrieval speed are paramount, understanding the performance of storage solutions is crucial. One of the fundamental components of this landscape is Linux block volume performance calculation. Whether you're a system administrator, a developer, or an enthusiast, delving into the intricacies of block volume performance, including Fio-based tests, can empower you to make informed decisions about storage setups. In this blog post, we'll demystify the concepts behind Linux block volume performance calculation and explore the key factors that influence it, along with practical Fio-based tests.
Understanding Block Volumes:
Block volumes are a type of storage solution commonly used in modern IT infrastructures. They provide raw storage space that can be partitioned and formatted according to the user's needs. These volumes are often found in virtual machines, cloud instances, and even physical servers. They are characterized by their ability to handle data at the block level, meaning data is read from and written to storage in fixed-size blocks.
Factors Influencing Block Volume Performance:
Several factors play a pivotal role in determining the performance of Linux block volumes. Understanding these factors helps optimize storage systems for better efficiency and responsiveness.
1. I/O Operations Per Second (IOPS): IOPS refers to the number of input/output operations a storage device can handle in a second. It is a key metric in assessing storage responsiveness. The higher the IOPS, the faster the storage system can read from or write to the block volume.
2. Throughput: Throughput measures the amount of data that can be transferred between the storage device and the system in a given period. It's usually measured in megabytes or gigabytes per second. Throughput is a crucial metric when dealing with large data transfers.
3. Latency: Latency is the delay between initiating a data request and receiving the first byte of data. Lower latency indicates a more responsive storage system. Excessive latency can lead to delays in data-intensive operations.
4. Queue Depth: Queue depth refers to the number of I/O requests that can be in the queue to the storage device at a given time. A higher queue depth can lead to improved performance, especially in scenarios with concurrent I/O operations.
Calculating Block Volume Performance:
While calculating precise block volume performance can be intricate, here's a simplified approach:
1. IOPS Calculation: Determine the total IOPS required by considering the application's read and write demands. Divide this total by the number of block volumes to distribute the load. It's important to consider peak I/O requirements.
2. Throughput Calculation: Calculate the required throughput by estimating the data transfer needs of the application. Divide this by the number of block volumes for load distribution.
3. Latency Estimation: Latency is affected by various factors, including the speed of the storage media and the efficiency of the underlying technology. Faster media and optimized configurations lead to lower latency.
Friday, June 12, 2020
How to fix in-acessible instance in Oracle Cloud Infrastructure (OCI)
Step-by-Step Guide
1. Stop the instance from the OCI Compute console.- Select the instance from the OCI Compute Console.
- Select 'Boot Volume' from the Resources.
- Click the '...' on the boot volume snd select 'Detach'.
- Select 'Attached Block Volumes' from the Resources.
- Click ' Attach Block Volume' and select the broken volume from the 'BLOCK VOLUME' tab.
- Click Attach - just make sure you have selected READ/Write' and attach the volume as Paravirtualized one so that you do not have to run the iSCSI commands.
Important: Run the commands as root user.
If the disk is attached and connected properly, you should be able to view it using 'lsblk' or similar commands:
[opc@jay ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 46.6G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 8G 0 part [SWAP]
└─sda3 8:3 0 38.1G 0 part /
sdb 8:16 0 47G 0 disk >>>>> the disk is detected as /dev/sdb
├─sdb1 8:17 0 512M 0 part >>>>> Boot partition
├─sdb2 8:18 0 8G 0 part
└─sdb3 8:19 0 38.1G 0 part >>>>> Root partition
[opc@jay ~]$7. Mount the root partition on the broken disk on the temporary directory.
# mkdir /recovery
# mount /dev/sdb3 /recovery
You might need to specify -o nouuid for some OS.
8. Analyze the logs and perform the recovery steps.
You have access to root volume of the broken instance under /recovery directory. You may now check the logs on the broken instance and apply the fixes accordingly.
- For ssh issues, I suggest checking logs under /recovery/var/log/secure (For RHEL/OEL/CentOS), /recovery/var/log/auth.log (Debian/Ubuntu).
- You can add a pubic key to the opc using by appending the key to file /recovery//home/opc/.ssh/authorized_keys file.
- For boot issues, check /recovery/var/log/boot.log, /recovery/var/log/messages, /recovery/var/log/dmesg log files.
- You can check and update the fstab entries here: /recovery/etc/fstab.
Once the recovery processes are done, you may proceed to detach the volume and attach it back to the original instance as boot volume.
- Select the instance from the OCI Compute Console.
- Select 'Boot Volume' from the Resources.
- Click the '...' on the boot volume (it should be the same volume we detached earlier).
- Select 'Attach'.
16. Check if the issue has been fixed, if not you need to redo the above process to check the logs again and try to fix it.
More Information
[1] Detach Boot Volume: https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/detachingabootvolume.htm[2] Connecting to a Volume: https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/connectingtoavolume.htm
[3] Disconnecting From a Volume: https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/disconnectingfromavolume.htm
[4] Attaching a Boot Volume https://docs.us-phoenix-1.oraclecloud.com/Content/Block/Tasks/attachingabootvolume.htm