Create LVM Partition Using fdisk or parted (Step-by-Step Guide)

Problem Overview

  • In many Linux systems, LVM volumes are created directly on a whole disk (for example, /dev/sdb). However, in some environments, storage policies require creating an LVM-specific partition first (such as /dev/sdb1) before adding it to LVM.

  • This approach is commonly used when:

    • The disk may be shared or repurposed in the future

    • The organization follows strict partitioning standards

    • The system uses GPT or multi-partition layouts

    • Storage needs to be clearly separated at the partition level

  • The goal is to create a dedicated partition for LVM using fdisk or parted, mark it as an LVM partition, and then use it inside the volume group instead of assigning the whole disk directly.

Prerequisites

Before starting, make sure the following conditions are met:

  • You are working with a new or unused disk (no important data on it)

  • You have root or sudo access

  • Backups or snapshots are available in case of mistakes

Solution

  • Confirm that the OS detects the newly added disk. You should see the new disk (for example /dev/sdb) without any partitions.
    • [root@pythonlinuxhub ~]# lsblk
      NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
      sda                8:0    0   20G  0 disk
      ├─sda1             8:1    0    1G  0 part /boot
      └─sda2             8:2    0   19G  0 part
        ├─rhel_10-root 253:0    0   17G  0 lvm  /
        └─rhel_10-swap 253:1    0    2G  0 lvm  [SWAP]
      sdb                8:16   0    6G  0 disk
      sr0               11:0    1 1024M  0 rom
  • View the current partition table and confirm that the new disk has unallocated space available for creating an LVM partition.

    • [root@pythonlinuxhub /]# parted
      GNU Parted 3.5
      Using /dev/sda
      Welcome to GNU Parted! Type 'help' to view a list of commands.
      (parted) print free
      Model: ATA VBOX HARDDISK (scsi)
      Disk /dev/sda: 21.5GB
      Sector size (logical/physical): 512B/512B
      Partition Table: msdos
      Disk Flags:
      
      Number  Start   End     Size    Type     File system  Flags
              1024B   1049kB  1048kB           Free Space
       1      1049kB  1075MB  1074MB  primary  xfs          boot
       2      1075MB  21.5GB  20.4GB  primary               lvm
      
      (parted) q
  • Create a new partition on the disk using fdisk (or parted)
    • Create a primary partition on the new disk and allocate the required size for LVM usage.

      • [root@pythonlinuxhub /]# fdisk /dev/sdb
        Command (m for help): p
        
        Disk /dev/sdb: 6 GiB, 6442450944 bytes, 12582912 sectors
        Disk model: VBOX HARDDISK
        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: 0x8d1f2e55
        
        Command (m for help): n
        Partition type
           p   primary (0 primary, 0 extended, 4 free)
           e   extended (container for logical partitions)
        Select (default p): p
        Partition number (1-4, default 1): 1
        First sector (2048-12582911, default 2048):
        Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-12582911, default 12582911): +1G
        
        Created a new partition 1 of type 'Linux' and of size 1 GiB.
    • Update the partition type code to 8e (Linux LVM) so the system recognizes it as an LVM partition.

      • Command (m for help): t
        Selected partition 1
        Hex code or alias (type L to list all): 8e
        Changed type of partition 'Linux' to 'Linux LVM'.
    • Print the partition table to verify the configuration, then write the changes to disk.
      • Command (m for help): p
        Disk /dev/sdb: 6 GiB, 6442450944 bytes, 12582912 sectors
        Disk model: VBOX HARDDISK
        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: 0x8d1f2e55
        
        Device     Boot Start     End Sectors Size Id Type
        /dev/sdb1        2048 2099199 2097152   1G 8e Linux LVM
        
        Command (m for help): w
        The partition table has been altered.
        Calling ioctl() to re-read partition table.
        Syncing disks.
  • Notify the kernel about the updated partition table, so the new LVM partition becomes available without rebooting.
    • [root@pythonlinuxhub /]# partprobe
  • Confirm that the new partition (for example /dev/sdb1) now appears in the block device list and is ready to be used with LVM.
    • [root@pythonlinuxhub /]# lsblk
      NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
      sda                8:0    0   20G  0 disk
      ├─sda1             8:1    0    1G  0 part /boot
      └─sda2             8:2    0   19G  0 part
        ├─rhel_10-root 253:0    0   17G  0 lvm  /
        └─rhel_10-swap 253:1    0    2G  0 lvm  [SWAP]
      sdb                8:16   0    6G  0 disk
      └─sdb1             8:17   0    1G  0 part
      sr0               11:0    1 1024M  0 rom
  • Initialize the new partition for LVM use and make it available to the volume group.
    • root@pythonlinuxhub ~]# pvcreate /dev/sdb1
        Physical volume "/dev/sdb1" successfully created.
      [root@pythonlinuxhub ~]# pvs
        PV         VG      Fmt  Attr  PSize        PFree
        /dev/sda2  rhel_10 lvm2 a--   <19.00g         0
        /dev/sdb1          lvm2 ---  1020.00m   1020.00m
  • Extend the existing volume group so it includes the new LVM partition.

    • [root@pythonlinuxhub ~]# vgextend rhel_10 /dev/sdb1
        Volume group "rhel_10" successfully extended
  • Create a logical volume from the newly added space (for example, for /home).

    • [root@pythonlinuxhub ~]# lvcreate -n home -L 1020M rhel_10
        Logical volume "home" created.
      [root@pythonlinuxhub ~]# lvs
        LV   VG      Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
        home rhel_10 -wi-a----- 1020.00m
        root rhel_10 -wi-ao----  <17.00g
        swap rhel_10 -wi-ao----    2.00g
      [root@pythonlinuxhub ~]# vgs
        VG      #PV #LV #SN Attr   VSize  VFree
        rhel_10   2   3   0 wz--n- 19.99g    0
      [root@pythonlinuxhub ~]# pvs
        PV         VG      Fmt  Attr PSize    PFree
        /dev/sda2  rhel_10 lvm2 a--   <19.00g    0
        /dev/sdb1  rhel_10 lvm2 a--  1020.00m    0
  • Backup any existing data in /home if present, because mounting a new filesystem will erase the old data.

  • Create a filesystem on the new logical volume and prepare it for use.

    • [root@pythonlinuxhub ~]# mkfs.xfs /dev/rhel_10/home
  • Mount the filesystem temporarily to verify that everything works as expected.

    • [root@pythonlinuxhub ~]# mount /dev/rhel_10/home /home
  • Add a permanent entry to /etc/fstab so the filesystem mounts automatically at boot.

    • [root@pythonlinuxhub ~]# vim /etc/fstab
      /dev/rhel_10/home /home                          xfs     defaults        0 0
    • [root@pythonlinuxhub ~]# cat /etc/fstab
      
      #
      # /etc/fstab
      # Created by anaconda on Fri Jan  2 18:55:40 2026
      #
      # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
      # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
      #
      # After editing this file, run 'systemctl daemon-reload' to update systemd
      # units generated from this file.
      #
      /dev/mapper/rhel_10-root /                       xfs     defaults        0 0
      UUID=2e2b232a-2efe-4e8c-8cdb-894c0ac27465 /boot                   xfs     defaults        0 0
      /dev/mapper/rhel_10-swap none                    swap    defaults        0 0
      /dev/rhel_10/home /home                          xfs     defaults        0 0
  • Validate the mount configuration and confirm that the new filesystem is active.

    • [root@pythonlinuxhub ~]# findmnt --verify
      Success, no errors or warnings detected
      [root@pythonlinuxhub ~]# mount -a
      mount: (hint) your fstab has been modified, but systemd still uses
             the old version; use 'systemctl daemon-reload' to reload.
      [root@pythonlinuxhub ~]# systemctl daemon-reload
    • [root@pythonlinuxhub ~]# lsblk
      NAME             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
      sda                8:0    0   20G  0 disk
      ├─sda1             8:1    0    1G  0 part /boot
      └─sda2             8:2    0   19G  0 part
        ├─rhel_10-root 253:0    0   17G  0 lvm  /
        └─rhel_10-swap 253:1    0    2G  0 lvm  [SWAP]
      sdb                8:16   0    6G  0 disk
      ├─sdb1             8:17   0    1G  0 part
      │ └─rhel_10-home 253:2    0 1020M  0 lvm
      └─sdb2             8:18   0    2G  0 part
      sr0               11:0    1 1024M  0 rom

Note:

  • Always verify the correct disk name before creating or modifying partitions.

  • Incorrect /etc/fstab entries may prevent the system from booting, review carefully. Run findmnt --verify command to validate the entries in /etc/fstab

  • Take a snapshot or backup before making storage changes

Shaik Mohammed Faruk

Software Engineer sharing practical tutorials and insights on Linux, Python, SQL, and modern technologies.

Read more About Me

0 0 votes
Article Rating
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Thanks for your interest!

Content for this is getting ready and will be published soon.

0
Would love your thoughts, please comment.x
()
x