Tag: linux

  • How to Benchmark Enterprise Storage: Fio and Vdbench Explained

    How to Benchmark Enterprise Storage: Fio and Vdbench Explained

    Enterprise storage arrays from vendors like Dell EMC, NetApp, and Pure Storage are the foundation of mission-critical IT environments. Ensuring these systems deliver consistent, high performance under real-world workloads is essential for application reliability and business continuity. In this post, we’ll explore how to benchmark enterprise storage using two industry-leading tools- Fio and Vdbench– with practical configuration examples and best practices.

    Why Benchmarking Enterprise Storage is Unique

    Enterprise arrays are not just fast disks-they’re complex systems with:

    • Multiple controllers and cache layers
    • Advanced data protection (RAID, erasure coding)
    • High-speed protocols (Fibre Channel, iSCSI, NVMe-oF)
    • Storage tiering and virtualization
    • Multi-protocol (block, file) support

    Benchmarking these systems is different from testing a single SSD or HDD. You must simulate production-like workloads, test at scale, and observe performance under both normal and failure conditions.

    Best Practices for Enterprise Storage Benchmarking

    • Simulate real-world workloads: Use realistic mixes of random/sequential I/O, read/write ratios, and block sizes.
    • Test at scale: Ensure test data sets exceed cache sizes and run with sufficient concurrency.
    • Run long-duration tests: Observe steady-state performance, not just short-term cache hits.
    • Monitor the full stack: Track storage, network, and server metrics.
    • Document everything: Record hardware/software versions, configurations, and test parameters.
    • Include failure scenarios: Simulate controller or network failures to test resilience.

    Fio: Flexible I/O Tester

    Fio is a versatile, scriptable tool ideal for generating a wide range of I/O workloads against enterprise storage.

    Example Fio Job File for Enterprise Storage
    text[global]
    ioengine=libaio
    direct=1
    rw=randrw
    rwmixread=70
    bs=8k
    iodepth=64
    numjobs=8
    size=100G
    runtime=3600
    time_based
    group_reporting
    filename=/dev/sdx # Replace with your LUN or device

    [verify]
    verify=crc32

    What this does:

    • Simulates a 70% read/30% write random workload with 8KB blocks.
    • Runs 8 parallel jobs with a queue depth of 64 for 1 hour.
    • Uses direct I/O to bypass the OS cache.
    • Verifies data integrity with CRC32.

    Run it with:

    sudo fio enterprise_test.fio

    Tips:

    • Use multiple devices or files to simulate multi-volume workloads.
    • Adjust concurrency (numjobs, iodepth) to match your environment.
    • Use --output-format=json for detailed reporting.

    Vdbench: Enterprise Workload Generator

    Vdbench is designed for complex, multi-host enterprise storage validation and offers granular workload definition and data validation.

    Example Vdbench Configuration
    text# Storage Definitions for multiple LUNs
    sd=sd1,lun=/dev/sdb,size=100g,openflags=o_direct
    sd=sd2,lun=/dev/sdc,size=100g,openflags=o_direct
    sd=sd3,lun=/dev/sdd,size=100g,openflags=o_direct
    sd=sd4,lun=/dev/sde,size=100g,openflags=o_direct

    # Workload Definition: 67% read, 33% write, 8KB random
    wd=wd1,sd=(sd1-sd4),xfersize=8k,rdpct=67,seekpct=100

    # Run Definition: max I/O, 24 hours, 1s reporting
    rd=rd1,wd=wd1,iorate=max,elapsed=86400,interval=1

    Run it with:

    vdbench -f enterprise_vdbench.conf

    Advanced tips:

    • Use the hd section to define multiple hosts for distributed testing.
    • Simulate failures (e.g., disconnect a path or controller) during the run to observe failover behavior.
    • Use fsd and fwd for NAS/file workloads.

    Key Steps for Success

    1. Profile your workload: Know your application’s I/O patterns. (capture the workload IO pattern)
    2. Prepare your environment: Use dedicated test LUNs/volumes.
    3. Configure your tools: Use Fio or Vdbench job files that match your workload.
    4. Run and monitor: Capture storage, host, and network metrics.
    5. Analyze results: Look for steady-state performance, latency spikes, and the impact of failures.
    6. Document and repeat: Ensure tests are reproducible and results are transparent.

    Conclusion

    Benchmarking enterprise-class storage is about more than just peak numbers-it’s about understanding how your array performs under pressure, during failures, and with your real workloads. Tools like Fio and Vdbench provide the flexibility, power, and validation features needed for accurate, actionable results. By following best practices and using realistic configurations, you can ensure your storage infrastructure is ready for the demands of the modern enterprise.

    References:

    • SNIA Storage Performance Testing Guide
    • Fio and Vdbench Official Documentation
  • Ubuntu VMs get same IP from DCHP in vSphere

    The problem

    This is a quick post to present a solution to this problem that bugged me for a while. If you are using Ubuntu as the guest OS for vSphere virtual machines you might encounter this problem. I was running Ubuntu 22.04 but I think it might be the same problem for other versions.

    Every new VM I created was getting the same IP address from the DCHP server even though the MAC address was different.

    The explanation

    I had a Ubuntu VM template configured for DHCP as follows:

    root@albmtest:~# cat /etc/netplan/99-netcfg-vmware.yaml
    # Generated by VMWare customization engine.
    network:
      version: 2
      renderer: networkd
      ethernets:
        ens160:
          dhcp4: yes
          dhcp4-overrides:
            use-dns: false
          nameservers:
            addresses:
              - 172.24.1.10

    The explanation is that by default Ubuntu’s Netplan doesn’t use the MAC address for DHCP. By default it uses the “machine-id”. This is explained in this paragraph of the Netplan documentation.

    So, unless you set “dhcp-identifier” to “mac“, by default netplan uses “machine-id“. You can find this in “/etc/machine-id” inside the VM. But as I found out, it transpires VMware doesn’t change regenerate “/etc/machine-id” in the guest by default. When you put those 2 default behaviors together you get a problem.

    The Solution

    You can solve this by either:

    • erasing the machine-id before creating a template by running “echo > /etc/machine-id“
    • editing the netplan yaml file to force it to use “mac” addresses for DHCP
    root@albmtest:~# cat /etc/netplan/99-netcfg-vmware.yaml
    # Generated by VMWare customization engine.
    network:
      version: 2
      renderer: networkd
      ethernets:
        ens160:
          dhcp4: yes
          dhcp4-overrides:
            use-dns: false
          dhcp-identifier: mac
          nameservers:
            addresses:
              - 172.24.1.10

    If you modify “netplan” don’t forget to “apply” to make sure any changes you make are activated.

    root@albmtest:~# netplan apply

    Final TIP: when you are testing your changes, you can force the DHCP client to renew the IP like this

    root@albmtest:~# dhclient -r

    I hope this post saved you some trouble. Good luck!

  • Best Practices For Running Oracle Database On XtremIO X2

    Summary

    DEllEMC’s XtremIO has simple, easy-to-use management. The XtremIO Management Server (XMS) delivers an HTML5 user interface that is a simple and easy-to-use interface for storage administrators. XMS allows storage administrators the ability to provisions storage with very little setup and planning.

    Hope this post is helpful to all Oracle users trying to get best out of their XtremIO investments.

    XtremIO is designed and optimized for databases and for DBAs, providing the following benefits.

    Predictable Performance

    • XtremIO provides predictable and consistency low-latency performance
    • With XtremIO scale-up and scale-out architecture, year-to-year growth is easy. The initial investment is preserved and application performance is improved.
    • Performance is predictable and provides best response times regardless of the workload and environment – be it production, QA, test or development

    Incredible Simplicity

    Agility

    • The typical enterprise applications require multiple copies such as test/development, reporting or online analytics. DBAs and test/dev engineers often have to spend hours managing the DB creation and refreshing the environments while often being limited by capacity, performance, and the number of copies.
    • XtremIO’s Integrated Copy Data Management (iCDM) allows for instant XtremIO Virtual Copies (XVCs) to be created from production with no performance impact.
    • These copies can be repurposed for near real-time analytics, test/dev and any other use case- all with complete space efficiency.

    Protection

    • Protecting the database is easy with XtremIO
    • There is no need for any design covering RAID type, data file capacity, load balancing, and tuning.
    • The data is protected with a proprietary flash-optimized algorithm called XtremIO Data Protection (XDP).
    • XDP is very different from RAID in several ways. Since XDP is always working within an all-flash storage array, several criteria were important in the design of this protection scheme. XDP benefits include ultra-low capacity overhead, high levels of data protection in case of double SSD failure, rapid rebuild times, flash endurance, and of course extreme performance
    • With XtremIO virtual copies it is easy to protect and recover from any operational and logical corruption; XVC’s allow the creation of frequent point-in-time copies (according to RPO intervals – seconds, minutes, hours) and use them to recover from any data corruption
    • An XVC can be kept in the system for as long as needed. Recovery using XtremIO virtual copy is instantaneous and does not impact system performance.

    ORACLE BEST PRACTICES

    1. General Guidelines

    Irrespective of using any application/database with XtremIO storage array below listed general guidelines are common.

    • Keep consistent, duplex link speed on all paths between the host and the XtremIO cluster
    • To ensure continuous access to XtremIO storage during a cluster software upgrade, verify that minimum I/O timeout of 30 seconds is set on the HBAs of all hosts connected to the affected XtremIO cluster. Also, verify that a minimum timeout of 30 seconds is set for all applications that are using storage from the XtremIO cluster.
    • The HBA queue depth (also referred to as execution throttle) controls the amount of outstanding I/O requests per HBA port. The HBA queue depth should be set to the maximum value
    • The LUN queue depth controls the amount of outstanding I/O requests per single path. These settings are controlled in the driver module for the card at the OS level. When connecting Linux host to XtremIO, a LUN queue depth setting should retain its default values.
    • I/O scheduling controls how I/O operations are submitted to storage. Linux offers various I/O algorithms (also known as “I/O Elevators“) to accommodate the different workloads. When connecting a Linux host to XtremIO storage, set the I/O elevator to either noop or deadline. It is not recommended to use the cfq I/O elevator setting, as it’s less optimal for XtremIO storage.
    • It is HIGHLY RECOMMENDED to follow the latest “XtremIO Host Configuration Guide” for all operating system which will use storage from XtremIO
    • If DB is virtualized then make sure all Virtual Machine components are provisioned from XtremIO storage (OS, Application/Binary, Swap, Paging, etc.)

    2. Oracle ASM

    Oracle Automatic Storage Management (ASM) is Oracle’s recommended software for supporting Oracle database files.

    For more information on ASM please refer this link

    • ASM General Recommendation
      • External redundancy is recommended for XtremIO
      • The XtremIO Storage Array natively provides flash-optimized data protection
    • Database Files Location in ASM Disk Groups
      • Best practices for storing Oracle DBMS file types in ASM disk groups are mentioned as below.
    Oracle Database Files Location in ASM disk groups

    Note: The second REDO data group (DG) is applicable if REDO logs are multiplexed.


    • Number of LUNs per Disk Group
      • Excellent cluster performance is achieved using an XtremIO Storage Array with just single LUN in a single disk group. However, in order to maximize performance from a single host, parallelism and adequate utilization of device queues are required.
      • The best practice to achieve this is by using a minimum of four LUNs for the data disk group. Doing this enables the hosts to use parallelism and ensures optimal performance without any bottlenecks.
      • The best practices for Disk group configuration and data placement are outlined in the below table.
    Number of LUNs per disk group
    •  512 verses 4K Advanced Format Considerations
      • The default setting for XtremIO volumes is 512 bytes. It is recommended to keep the default setting and not use 4K Advanced Format.

    3. Multiblock I/O Request Sizes

    Oracle Database performs I/O on data files in multiples of the database block size (db_block_size), which by default is 8KB. The default Oracle Database block size is optimal on XtremIO. XtremIO supports larger block sizes as well. In the case of multiblock I/O one should tune the Oracle Database initialization parameter db_file_multiblock_read_count to limit the requests to 128KB. This is derived with the following formula:

    db_file_multiblock_read_count is db_file_multiblock_read_count = 128KB / db_block_size

    Usually, Oracle DB is optimized to perform very large transfers to mitigate the seek cost due to multiblock reads on mechanical/spinning drives. In a seek-free storage environment, such as XtremIO, there is no need for such mitigation. Also, most modern FC HBAs require OS to segment large requests into multiple requests. For example, an application IO of 1MB is fragmented by Linux block I/O layer into two 512KB transfers to suit HBA max transfer size.

    4. REDO Log Block Size

    The default block size for REDO LOG is 512 bytes. I/O requests sent to the redo log files are in increments of the redo block size. This is the blocking factor Oracle uses within REDO LOG files and has nothing to do with the on-disk format of the XtremIO LUN.

    XtremIO’s recommendation is to create REDO LOG files with 4K block size. For more details on this please check Oracle Support notes 1681266.1.


    Note: For Oracle version prior to 12.2.0.1.0, you should set the parameter _disk_sector_size_override to TRUE when creating a redo log with 4K block size in the database instance.

    Do not set the parameter _disk_sector_size_override in the ASM instance. Once the instance is running, simply add more redo logs with the BLOCKSIZE option set to 4KB and then drop any redo logs that have default 512B block size.


    5. Grid Infrastructure Files – OCR/Voting

    The block size for both Oracle Cluster Registry (OCR) and Cluster Synchronization Services (CSS) voting files are 512 bytes, hence I/O is therefore sized as multiple of 512 bytes. This is consistent with XtremIO’s best practices and hence no changes are needed in OCR/Voting files.

    6. Oracle DB Level Compression & Encryption

    XtremIO has inline data reduction (deduplication and compression) running all the time without the performance penalty and stores 100% of data in encrypted format using Data At Rest Encryption (D@RE). This makes Oracle DB level compression and encryption as redundant.

    XtremIO data services work for all the data stored on arrays, unlike being selective like Oracle. Also XtremIO no not use host CPU for data services, which is an expensive resource in the Oracle environment.

    With XtremIO it is a best practice to disable / not use application-level Compression and Encryption services.

    XtremIO Advanced Services for Oracle

    XtremIO offers a wide variety of use cases to simplify database environment workflow. XtremIO comes along with a tool called iCDM (Integrated Copy Data Management) which allows automating all Copy Data Management (CDM) tasks in DB environments.

    Few use cases are mentioned below.

    1. Modern Backup-to-Disk using XtremIO XVC

    XtremIO XVCs (XtremIO Virtual Copy) are precise point-in-time copies of source volumes which basically are a collection of metadata pointers to the source volume blocks. Therefore, XVC consumes minimal physical capacity.

    Executing XVCs is extremely fast and hence most efficient backup-to-disk methodology. The best part is this process does not utilize production/source server resources for creating backup-to-disk copy. Over time as source data is updated/changed, only unique data is stored on XtremIO in compressed format.

    2. XtremIO XVC for Manual Continuous Data Protection (CDP)

    XtremIO XVCs are so efficient that these can be used as part of a business continuity strategy. Below mentioned two options can be used for this.

    • Crash-Consistent (or “Restart-able” Image)
      • A crash-consistent or restartable image is a point-in-time image of the primary database on disk
      • This option involves taking XVC of the primary database while it is up and operational. The image that is captured is similar to the state of the primary database.
      • During the DB restart on the XVC, the DB automatically performs a recovery using the online logs.
      • All committed transactions are included and all uncommitted transactions are rolled back.
    • Application/DB-Consistent (“Recoverable” Image) –
      • A recoverable image is a point-in-time image of the primary database on disk
      • This option involves taking XVC of the primary DB while DB is in “Backup” mode
      • Highly recommended to have a backup file of the control file prior and after the completion of the XVC process.Unlike crash-consistent copy, data files can be rolled forward in time using logs – up to latest or desired SCN (captured in the control file)

    3. XtremIO XVC for Cloning Primary Database (BCV Copy)

    BCV / clones of the primary copies can be created using XtremIO XVCs. Methods for clone creation are as mentioned in “2. XtremIO XVC for Manual Continuous Data Protection (CDP)”

    operating System Best Practices

    When it comes to performance optimization operating system settings also play a major role. It is highly recommended to follow all the operating system best practices as listed in the “XtremIO Host Configuration Guide”.

    The absence of host best practices might result in host-bound performance than XtremIO bound performance. In short, the host/operating system might become the bottleneck, because of the host/operating system level queuing.

  • Linux – Creating Local RAID5 using fdisk

    This blogs lists the steps around creating RAID5 volume on Linux using local disks.

    We will start by installing software RAID on Linux system

    # yum install mdadm
    Loaded plugins: ulninfo
    Resolving Dependencies
    --> Running transaction check
    ---> Package mdadm.x86_64 0:4.1-1.0.1.el7 will be installed
    --> Processing Dependency: libreport-filesystem for package: mdadm-4.1-1.0.1.el7.x86_64
    --> Running transaction check
    ---> Package libreport-filesystem.x86_64 0:2.1.11-43.0.1.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package                  Arch       Version               Repository      Size
    ================================================================================
    Installing:
     mdadm                    x86_64     4.1-1.0.1.el7         ol7_latest     435 k
    Installing for dependencies:
     libreport-filesystem     x86_64     2.1.11-43.0.1.el7     ol7_latest      40 k
    
    Transaction Summary
    ================================================================================
    Install  1 Package (+1 Dependent package)
    
    Total download size: 475 k
    Installed size: 1.0 M
    Is this ok [y/d/N]: y
    Downloading packages:
    (1/2): libreport-filesystem-2.1.11-43.0.1.el7.x86_64.rpm   |  40 kB   00:00
    (2/2): mdadm-4.1-1.0.1.el7.x86_64.rpm                      | 435 kB   00:00
    --------------------------------------------------------------------------------
    Total                                              1.8 MB/s | 475 kB  00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : libreport-filesystem-2.1.11-43.0.1.el7.x86_64                1/2
      Installing : mdadm-4.1-1.0.1.el7.x86_64                                   2/2
      Verifying  : mdadm-4.1-1.0.1.el7.x86_64                                   1/2
      Verifying  : libreport-filesystem-2.1.11-43.0.1.el7.x86_64                2/2
    
    Installed:
      mdadm.x86_64 0:4.1-1.0.1.el7
    
    Dependency Installed:
      libreport-filesystem.x86_64 0:2.1.11-43.0.1.el7
    
    Complete!

    Now let’s identify disks which we will use for creating RAID5 volume. These disks can be local or storage LUNs. You can list the disks using running below command. In this example we will use 5 local disks – /dev/xvd(b-f)

    # fdisk -l | grep /dev/
    Disk /dev/xvda: 53.7 GB, 53687091200 bytes, 104857600 sectors
    /dev/xvda1   *        2048     4098047     2048000   83  Linux
    /dev/xvda2         4098048    86018047    40960000   83  Linux
    /dev/xvda3        86018048   104857599     9419776   82  Linux swap / Solaris
    Disk /dev/xvdd: 53.7 GB, 53687091200 bytes, 104857600 sectors
    Disk /dev/xvde: 53.7 GB, 53687091200 bytes, 104857600 sectors
    Disk /dev/xvdb: 53.7 GB, 53687091200 bytes, 104857600 sectors
    Disk /dev/xvdc: 53.7 GB, 53687091200 bytes, 104857600 sectors
    Disk /dev/xvdf: 53.7 GB, 53687091200 bytes, 104857600 sectors
    

    Before you begin make sure that selected drives do not have existing RAID configured.

    # mdadm -E /dev/xvd[b-f]
    mdadm: No md superblock detected on /dev/xvdb.
    mdadm: No md superblock detected on /dev/xvdc.
    mdadm: No md superblock detected on /dev/xvdd.
    mdadm: No md superblock detected on /dev/xvde.
    mdadm: No md superblock detected on /dev/xvdf.

    Next step is to create partition on selected disks using fdisk. Follow below steps for each selected disks – /dev/xvd(b-f) in this example

    # fdisk /dev/xvdc
    Welcome to fdisk (util-linux 2.23.2).
    
    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
    Building a new DOS disklabel with disk identifier 0x6845b853.
    
    Command (m for help): n
    Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
    Select (default p): p
    Partition number (1-4, default 1): 1
    First sector (2048-104857599, default 2048):
    Using default value 2048
    Last sector, +sectors or +size{K,M,G} (2048-104857599, default 104857599):
    Using default value 104857599
    Partition 1 of type Linux and of size 50 GiB is set
    
    Command (m for help): t
    Selected partition 1
    Hex code (type L to list all codes): fd
    Changed type of partition 'Linux' to 'Linux raid autodetect'
    
    Command (m for help): p
    
    Disk /dev/xvdc: 53.7 GB, 53687091200 bytes, 104857600 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
    Disk label type: dos
    Disk identifier: 0x6845b853
    
        Device Boot      Start         End      Blocks   Id  System
    /dev/xvdc1            2048   104857599    52427776   fd  Linux raid autodetect
    
    Command (m for help): w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    Syncing disks.

    Once you’ve successfully created the partitions for all disks, you can verify the changes using below command

    # mdadm -E /dev/xvd[b-f]
    /dev/xvdb:
       MBR Magic : aa55
    Partition[0] :    104855552 sectors at         2048 (type fd)
    /dev/xvdc:
       MBR Magic : aa55
    Partition[0] :    104855552 sectors at         2048 (type fd)
    /dev/xvdd:
       MBR Magic : aa55
    Partition[0] :    104855552 sectors at         2048 (type fd)
    /dev/xvde:
       MBR Magic : aa55
    Partition[0] :    104855552 sectors at         2048 (type fd)
    /dev/xvdf:
       MBR Magic : aa55
    Partition[0] :    104855552 sectors at         2048 (type fd)

    Now create RAID device (/dev/md1 in below example) using all the newly created disk partitions

    # mdadm --create /dev/md1 --level=5 --raid-devices=5 /dev/xvdb1 /dev/xvdc1 /dev/xvdd1 /dev/xvde1 /dev/xvdf1
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md1 started.

    Note that it takes some time to complete the RAID creation. You can monitor the progress using below command. Below command will show you current % completed.

    # cat /proc/mdstat
    Personalities : [raid6] [raid5] [raid4]
    md1 : active raid5 xvdf1[5] xvde1[3] xvdd1[2] xvdc1[1] xvdb1[0]
          209575936 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/4] [UUUU_]
          [=>...................]  recovery =  7.2% (3808256/52393984) finish=13.1min speed=61363K/sec
    
    unused devices: <none>
    

    But you prefer to watch screen till 100% completion then run below command. Result of this command will be persistent on the screen and will show you real time progress.

    # watch -n1 cat /proc/mdstat
    Every 1.0s: cat /proc/mdstat                            Mon Dec  2 09:41:04 2019
    
    Personalities : [raid6] [raid5] [raid4]
    md1 : active raid5 xvdf1[5] xvde1[3] xvdd1[2] xvdc1[1] xvdb1[0]
          209575936 blocks super 1.2 level 5, 512k chunk, algorithm 2 [5/4] [UUUU_]
          [==>..................]  recovery = 13.9% (7335304/52393984) finish=12.1mi
    n speed=61622K/sec
    
    unused devices: <none>

    Once RAID creation is 100% you can run below command to see the summary of the RAID device configuration. RAID device is /dev/md1 in below example with 5 devices – /dev/xvd(b-f)1

    # mdadm --detail /dev/md1
    /dev/md1:
               Version : 1.2
         Creation Time : Mon Dec  2 09:39:05 2019
            Raid Level : raid5
            Array Size : 209575936 (199.87 GiB 214.61 GB)
         Used Dev Size : 52393984 (49.97 GiB 53.65 GB)
          Raid Devices : 5
         Total Devices : 5
           Persistence : Superblock is persistent
    
           Update Time : Mon Dec  2 09:53:20 2019
                 State : clean
        Active Devices : 5
       Working Devices : 5
        Failed Devices : 0
         Spare Devices : 0
    
                Layout : left-symmetric
            Chunk Size : 512K
    
    Consistency Policy : resync
    
                  Name : ip-10-10-10-207:1  (local to host ip-10-10-10-207)
                  UUID : 07f28a7b:3c70d798:1deecf9a:292ddd2c
                Events : 18
    
        Number   Major   Minor   RaidDevice State
           0     202       17        0      active sync   /dev/xvdb1
           1     202       33        1      active sync   /dev/xvdc1
           2     202       49        2      active sync   /dev/xvdd1
           3     202       65        3      active sync   /dev/xvde1
           5     202       81        4      active sync   /dev/xvdf1
    

    At this point we have RAID5 device created (/dev/md1). Now we need to create file system. In below example we are creating EXT4 file system

    # mkfs.ext4 /dev/md1
    mke2fs 1.42.9 (28-Dec-2013)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=128 blocks, Stripe width=512 blocks
    13099008 inodes, 52393984 blocks
    2619699 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=2199912448
    1599 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872
    
    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    

    Once the file system is created on RAID5 device, create the mount point and mount the RAID5 device on the same.

    # mkdir /mnt/ebs_r5
    # mount /dev/md1 /mnt/ebs_r5
    # df -h
    Filesystem        Size  Used Avail Use% Mounted on
    devtmpfs           32G     0   32G   0% /dev
    tmpfs              32G     0   32G   0% /dev/shm
    tmpfs              32G   17M   32G   1% /run
    tmpfs              32G     0   32G   0% /sys/fs/cgroup
    /dev/xvda2         39G  2.9G   34G   8% /
    /dev/xvda1        1.9G  234M  1.6G  13% /boot
    tmpfs             6.3G     0  6.3G   0% /run/user/1000
    /dev/md1          197G   61M  187G   1% /mnt/ebs_r5

    Also make sure you’ve added entry for new mount point in the /etc/fstab file. So that mount point will be persistent across system reboots.

    # vi etc/fstab
    /dev/md1                /mnt/ebs_r5              ext4    defaults        0 0
    

    Lastly most important step is to save the RAID configuration. Run below command to make sure RAID configuration is saved.

    # mdadm --detail --scan --verbose >> /etc/mdadm.conf

    At this point you’ve successfully created RAID5 device on Linux.

  • Linux – Configure iSCSI Initiator

    This blog is not to explain what is iSCSI but rather a reference to steps which an administrator should follow for configuring iSCSI on their Linux host (CentOS in my case)

    Prerequisites

    1. Make sure Linux host has IP connectivity to storage appliance which is acting as iSCSI target
    2. Storage appliance has iSCSI configured and service is running

    Steps

    Install iSCSI initiator on Linux host. Below is the example

    # yum install iscsi-initiator-utils
    Loaded plugins: ulninfo
    Resolving Dependencies
    --> Running transaction check
    ---> Package iscsi-initiator-utils.x86_64 0:6.2.0.874-11.0.1.el7 will be installed
    --> Processing Dependency: iscsi-initiator-utils-iscsiuio >= 6.2.0.874-11.0.1.el7 for package: iscsi-initiator-utils-6.2.0.874-11.0.1.el7.x86_64
    --> Running transaction check
    ---> Package iscsi-initiator-utils-iscsiuio.x86_64 0:6.2.0.874-11.0.1.el7 will be installed
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    =======================================================================================================================================================
     Package                                          Arch                     Version                                  Repository                    Size
    =======================================================================================================================================================
    Installing:
     iscsi-initiator-utils                            x86_64                   6.2.0.874-11.0.1.el7                     ol7_latest                   428 k
    Installing for dependencies:
     iscsi-initiator-utils-iscsiuio                   x86_64                   6.2.0.874-11.0.1.el7                     ol7_latest                    93 k
    
    Transaction Summary
    =======================================================================================================================================================
    Install  1 Package (+1 Dependent package)
    
    Total download size: 521 k
    Installed size: 2.6 M
    Is this ok [y/d/N]: y
    Downloading packages:
    (1/2): iscsi-initiator-utils-6.2.0.874-11.0.1.el7.x86_64.rpm                                                                    | 428 kB  00:00:00
    (2/2): iscsi-initiator-utils-iscsiuio-6.2.0.874-11.0.1.el7.x86_64.rpm                                                           |  93 kB  00:00:00
    -------------------------------------------------------------------------------------------------------------------------------------------------------
    Total                                                                                                                  1.1 MB/s | 521 kB  00:00:00
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : iscsi-initiator-utils-iscsiuio-6.2.0.874-11.0.1.el7.x86_64                                                                          1/2
      Installing : iscsi-initiator-utils-6.2.0.874-11.0.1.el7.x86_64                                                                                   2/2
      Verifying  : iscsi-initiator-utils-6.2.0.874-11.0.1.el7.x86_64                                                                                   1/2
      Verifying  : iscsi-initiator-utils-iscsiuio-6.2.0.874-11.0.1.el7.x86_64                                                                          2/2
    
    Installed:
      iscsi-initiator-utils.x86_64 0:6.2.0.874-11.0.1.el7
    
    Dependency Installed:
      iscsi-initiator-utils-iscsiuio.x86_64 0:6.2.0.874-11.0.1.el7
    
    Complete!

    Once iSCSI package is installed then edit the iSCSI configuration file and enable node.startup = automatic. You will need to find node.startup in the config file and remove the # from start of the line. This will make sure that iSCSI is logging to target automatically on startup

    vi /etc/iscsi/iscsid.conf
    
    node.startup = automatic

    Now configure the iSCSI service to start automatically. Run below command

    # systemctl enable iscsid
    Created symlink from /etc/systemd/system/multi-user.target.wants/iscsid.service to /usr/lib/systemd/system/iscsid.service.
    

    Start iSCSI service

    # systemctl start iscsid

    Now at this point you’ve iSCSI enabled on your Linux server. If you want to view iSCSI initiator name of your server then run below command. Note that in most cases iSCSI initiator name will reflect into logged in initiators on your storage appliance in some cases you’ll need to provide the initiator name.

    # cat /etc/iscsi/initiatorname.iscsi
    InitiatorName=iqn.1988-12.com.oracle:b0ed4f9c9b9d

    Now let’s discover iSCSI target nodes using your storage system iSCSI IP address.

    # iscsiadm -m discovery -t st -p 172.16.1.11
    172.16.1.11:3260,2 iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.a2
    172.16.1.12:3260,1 iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.b2

    You can run below commands to list discovered iSCSI nodes

    # iscsiadm -m node
    172.16.1.11:3260,2 iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.a2
    172.16.1.12:3260,1 iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.b2
    
    or 
    
    # ls /var/lib/iscsi/send_targets
    172.16.1.11,3260
    
    # ls /var/lib/iscsi/nodes
    iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.a2
    iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.b2
    

    Once iSCSI nodes are discovered you can run below command to login into iSCSI target

    # iscsiadm -m node --targetname "iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.a2" --portal "172.16.1.11:3260" --login
    Logging in to [iface: default, target: iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.a2, portal: 172.16.1.11,3260] (multiple)
    Login to [iface: default, target: iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.a2, portal: 172.16.1.11,3260] successful.
    
    # iscsiadm -m node --targetname "iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.b2" --portal "172.16.1.12:3260" --login
    Logging in to [iface: default, target: iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.b2, portal: 172.16.1.12,3260] (multiple)
    Login to [iface: default, target: iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.b2, portal: 172.16.1.12,3260] successful.

    At this stage you’ve Linux host configured as iSCSI initiator and logged in successfully to target storage. Now you can ask storage admin to create LUNs and assign to Linux host.

    Once LUNs are assigned to Linux host you can run below command to scan new devices

    # iscsiadm -m session --rescan
    Rescanning session [sid: 1, target: iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.a2, portal: 172.16.1.11,3260]
    Rescanning session [sid: 2, target: iqn.1992-04.com.emc:cx.asfnsdbgfkdjfgdk.b2, portal: 172.16.1.12,3260]

    You can view new devices using fdisk -l or multipath -l command

  • Ansible Master – Enabling SSH Key Based Authentication

    Ansible Master – Enabling SSH Key Based Authentication

    This section seems pretty straight-forward but is the must for all the Ansible deployments.

    Follow below steps to get through the password maze in Ansible environments

    Firstly we will need to generate the SSH authentication keys. This needs to be done on the server from which you want to login to other hosts. In my case it’s Ansible master server.

    Generate your key – Run the ssh-keygen command (as below). By default system will create and store the SSH key into /root/.ssh/id_rsa, which you can change. Passphrase is optional and you can leave it blank.

    Note that if you already have generated the SSH key you have option to overwrite the same, but make sure that earlier key is not used anywhere for authentication. Below example shows option to replace existing SSH keys

    [root@ansible-master ~]# ssh-keygen
    Generating public/private rsa key pair.
    Enter file in which to save the key (/root/.ssh/id_rsa):
    /root/.ssh/id_rsa already exists.
    Overwrite (y/n)? y
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in /root/.ssh/id_rsa.
    Your public key has been saved in /root/.ssh/id_rsa.pub.
    The key fingerprint is:
    SHA256:D52Rvc2F7JMlbikpj7G96Ys3bSLRUz4tNmsfNP4E2Vg root@ansible-master
    The key's randomart image is:
    +---[RSA 2048]----+
    |                 |
    |           o . . |
    |          o . + E|
    |         . o B.@ |
    |        S =.+o&+.|
    |         o.BooOoo|
    |          +.o+ B.|
    |          ..+o=.o|
    |          .+=* .o|
    +----[SHA256]-----+
    

    If you want to use existing keys then you can simply read the existing key which is saved in the file. Below is the example of the reading existing public key

    [root@ansible-master ~]# cat /root/.ssh/id_rsa.pub
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDoN5+wFiV3Nold4Y7KDGkvIGBqulvdDxDm3qPj7SGsHsnEZKKxbQtO2QJNDJW2tXhLLDxY7vnyQ3xiL0bXbUTkeHHANFY7yZnMH4LH1k51yAkgDdVzKYUdvVJ81qRmYaJUJnLCsKvZMFmg7/KzecuA1QU8WVDLCH02HiRsmqVPaykcR2EOKCgX7i92Q/khZycR66GvoKcVwU9LuDLlADQt9GTaFDFiXPITNayvXkWvL7bwe9arqMCJzmEpvveglJI+vLvh5793yxrszTScTuMpjvpp4Nz5Tk0NSvQqo73yiHAsFF6M7l2hnVskyj3cAOL1dzxmopC/E1qd3DrWSOX root@ansible-master
    

    Once you have generated the SSH key next step is to add the key into target system.

    For copying the SSH keys into target system simply follow below process.

    [root@ansible-master ~]# ssh-copy-id root@192.168.1.101
    /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
    The authenticity of host '192.168.1.101 (192.168.1.101)' can't be established.
    ECDSA key fingerprint is SHA256:qnOPcE09JqKALwLLaL+SqNMy2oubvhF/EevGCcK9S9A.
    ECDSA key fingerprint is MD5:4d:65:b7:e0:e8:09:41:a8:f9:4c:2d:b6:47:55:b2:09.
    Are you sure you want to continue connecting (yes/no)? yes
    /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
    /usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
    root@192.168.1.101's password:
    
    Number of key(s) added: 1
    
    Now try logging into the machine, with:   "ssh 'root@192.168.1.101'"
    and check to make sure that only the key(s) you wanted were added.
    

    You’ll notice in the command output that this process has added the key into the target system. Note that 192.168.1.101 in above example is target system in which I wanted Ansible master to login without username and password.

    Once the SSH keys are added into the target system now you can try SSH into the target system and it won’t ask for password anymore.

    [root@ansible-master ~]# ssh root@192.168.1.101
    Last login: Tue Nov 26 09:01:16 2019 from gateway
    [root@target-system ~]#
    

    Hope this saves time for many of us.