Skip to main content

Configuring Multipathing and Setting Up Storage on a Linux Server:

Ensuring high availability and redundancy in your storage environment is crucial for maintaining system reliability. Multipathing allows you to distribute I/O across multiple paths, providing fault tolerance and improved performance. This guide covers the entire process from configuring multipathing to setting up physical volumes (PVs), volume groups (VGs), and logical volumes (LVs) with different sizes. 

Prerequisites: 
Before you begin, make sure you have the following: 
  • Administrative access to the server 
  • Multipath tools installed on your server 
  • Basic understanding of Linux commands 
Step-by-Step Guide: 

1. Install Multipath Tools: 
Ensure that you have the necessary multipath tools installed:
# sudo yum install device-mapper-multipath
  • yum: Package manager for RHEL-based distributions. 
  • install: Command to install a package. 
  • device-mapper-multipath: Name of the package to be installed. 
2. Enable and Start the Multipath Service: 
Enable the multipath service to start at boot, and then start the service:
# sudo systemctl enable multipathd # sudo systemctl start multipathd
  • systemctl: Command to control the systemd system and service manager. 
  • enable: Configures the service to start at boot. 
  • multipathd: Name of the multipath daemon service. 
  • start: Starts the service immediately. 
3. Check the Multipath Configuration: 
Verify the current multipath configuration to understand the default settings:
# sudo multipath -t
  • multipath: Command to manage multipath devices. 
  • -t: Prints the default configuration. 
4. Edit the Configuration File: 
Create or edit the /etc/multipath.conf file to include your desired settings:
# sudo nano /etc/multipath.conf
  • nano: Text editor command. 
  • /etc/multipath.conf: Path to the multipath configuration file. 
Add the following configuration:
defaults { user_friendly_names yes find_multipaths yes } blacklist { }

5. Restart the Multipath Service:
 
After editing the configuration file, restart the multipath service to apply the changes:
# sudo systemctl restart multipathd
  • restart: Stops and starts the service to apply changes. 
6. Verify Multipath Devices: 
Check that the multipath devices are recognized correctly:
# sudo multipath -ll
  • -ll: Lists detailed information about multipath devices. 
7. Check Bindings and WWIDs: 
Ensure that your bindings and WWIDs are correctly set up:
# sudo cat /etc/multipath/bindings # sudo cat /etc/multipath/wwids
  • cat: Concatenate and display the contents of the files. 
  • /etc/multipath/bindings: File that contains multipath device bindings. 
  • /etc/multipath/wwids: File that contains WWIDs of multipath devices. 
Setting Up Physical Volumes (PVs) and Volume Groups (VGs): 

1. Create a Physical Volume (PV): 
Identify the multipath device name. You can use the multipath -ll command to list all multipath devices. Let's assume your multipath device is /dev/mapper/mpatha:
# sudo pvcreate /dev/mapper/mpatha
  • pvcreate: Command to initialize a physical volume. 
  • /dev/mapper/mpatha: Path to the multipath device.
2. Create a Volume Group (VG): 
Create a Volume Group (VG) using the newly created PV. For this example, let's name the Volume Group vg_data:
# sudo vgcreate vg_data /dev/mapper/mpatha
  • vgcreate: Command to create a volume group. 
  • vg_data: Name of the volume group. 
  • /dev/mapper/mpatha: Path to the multipath device. 
3. Verify the VG Creation: 
Verify that the Volume Group has been created successfully:
# sudo vgs
  • vgs: Command to display information about volume groups. 
Creating Logical Volumes (LVs): 

1. Create a Logical Volume Using the Entire Free Space: 
Create a logical volume using the entire free space. Let's call this logical volume lv_full:
# sudo lvcreate -n lv_full -l 100%FREE vg_data
  • lvcreate: Command to create a logical volume. 
  • -n lv_full: Specifies the name of the logical volume. 
  • -l 100%FREE: Uses 100% of the free space in the volume group. 
  •  vg_data: Name of the volume group. 
2. Create Logical Volumes with Specific Sizes: 
You can create additional logical volumes with specific sizes. For example, lv_data50 with a size of 50GB, and lv_data60 with a size of 60GB: 
For a 50GB logical volume:
# sudo lvcreate -n lv_data50 -L 50G vg_data
  • -L 50G: Specifies the size of the logical volume as 50GB. 
For a 60GB logical volume:
# sudo lvcreate -n lv_data60 -L 60G vg_data
  • -L 60G: Specifies the size of the logical volume as 60GB. 
Formatting and Mounting the Logical Volumes: 

1. Format the Logical Volumes: 
Format the logical volumes with the desired filesystem. For example, you can use ext4: 
For lv_full:
# sudo mkfs.ext4 /dev/vg_data/lv_full
  • mkfs.ext4: Command to create an ext4 filesystem on the device.
  • /dev/vg_data/lv_full: Path to the logical volume.
For lv_data50:
# sudo mkfs.ext4 /dev/vg_data/lv_data50
For lv_data60:
# sudo mkfs.ext4 /dev/vg_data/lv_data60

2. Mount the Logical Volumes:
 
Create directories to mount the logical volumes and then mount them: 
For lv_full:
# sudo mkdir /mnt/full # sudo mount /dev/vg_data/lv_full /mnt/full
  • mkdir: Command to create a directory.
  • mount: Command to mount a filesystem.
  • /mnt/full: Mount point for the logical volume.
For lv_data50:
# sudo mkdir /mnt/data50 # sudo mount /dev/vg_data/lv_data50 /mnt/data50
For lv_data60:
# sudo mkdir /mnt/data60 # sudo mount /dev/vg_data/lv_data60 /mnt/data60

3. Update /etc/fstab:
 
To ensure the logical volumes are mounted automatically at boot, add entries to the /etc/fstab file:
# sudo nano /etc/fstab
  • nano: Text editor command. 
Add the following lines: plaintext
/dev/vg_data/lv_full /mnt/full ext4 defaults 0 0 /dev/vg_data/lv_data50 /mnt/data50 ext4 defaults 0 0 /dev/vg_data/lv_data60 /mnt/data60 ext4 defaults 0 0
  • /dev/vg_data/lv_full, /dev/vg_data/lv_data50, /dev/vg_data/lv_data60: Paths to the logical volumes. 
  • /mnt/full, /mnt/data50, /mnt/data60: Mount points for the logical volumes. 
  • ext4: Filesystem type. 
  • defaults: Default mount options. 
  • 0 0: Filesystem check options. 
Conclusion: 
By following these steps and understanding the parameters, you can successfully configure multipathing, create physical volumes, volume groups, and logical volumes with different sizes. The logical volumes are formatted and mounted, ready for use. This setup ensures high availability, redundancy, and flexibility for your storage needs. 

If you encounter any issues or need further assistance, feel free to ask for help from your support team.

Comments

Popular posts from this blog

How to Check Hardware Details on Linux:

  Whether you're troubleshooting hardware issues, planning an upgrade, or just curious about your system’s specifications, Linux provides a variety of commands to gather comprehensive hardware information. Here are some essential commands: 1.  Use lscpu to get detailed information about the CPU, including architecture, cores, threads, and CPU speeds. # lscpu                                                 2. The lshw command provides a complete overview of hardware configuration, including CPU, memory, storage, and network. You’ll likely need superuser privileges to run it. # sudo lshw                                                                               ...

testing

09052025 T-1 { "volume_groups" : { "vgroot" : { "vgsize" : "304G" , "fs_type" : "xfs" } } , "logical_volumes" : { "root" : { "lvroot" : { "vgname" : "vgroot" , "lvname" : "lvroot" , "lvsize" : "12G" , "mountpoint" : "/" , "purpose" : "root filesystem" , "disk" : 1 , "partition" : 2 } } , "swap" : { "lvswap" : { "vgname" : "vgroot" , "lvname" : "lvswap" , "lvsize" : "4G" , "mountpoint" : "NA" , "purpose" : "swap" , "disk" : 1 , "partit...

How Virtual Machines are Created in OpenStack: A Complete Backend Workflow:

When creating a Virtual Machine (VM) in OpenStack, several components work together in the backend to provision the instance. Here's a step-by-step explanation of how the process flows: 1. User Request Interface Used : The user initiates the VM creation through the Horizon Dashboard (web UI), the OpenStack CLI ( openstack server create ), or the OpenStack API. Request Information : The request includes parameters such as: VM name. Image (the operating system or custom image to boot from). Flavor (the compute, memory, and storage specifications). Network (which network the VM will be connected to). Security Groups (firewall rules). Key Pair (for SSH access). 2. API (Nova API) Component : Nova (Compute service). Process : The request is received by the Nova API , which validates the request (checks if the requested resources like the image, flavor, and network exist). If valid, the API creates an entry in the database for the new instance. Nova's Role : Nova is the core service r...