ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Adding a PV Second Disk to CentOS 7 on a Scale HC3 with LVM and XFS

    IT Discussion
    linux centos centos 7 rhel rhel 7 scale scale hc3 lvm xfs linux server kvm virtio
    3
    12
    3.4k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      Here is what fdisk reports that our disks look like before we begin. This is after installation and after the second block device has been added. What we can see from the output of fdisk -l is that the /dev/vda device is used for the base installation and is of 16GB in size. The base installation, swap space and everything that we normally use is located on this single block device which has been partitioned into two partitions, /dev/vda1 and /dev/vda2.

      We can see that /dev/vdb is the name of our as yet unused newly added block device of 200.0 GB (in my example.)

      KVM VirtIO block devices get the /dev/vd* naming convention in CentOS and RHEL. If you use any other type of block device you will get a different device name, such as /dev/sd*. So be sure to double check this.

      [root@lab-lnx-centos ~]# fdisk -l
      
      Disk /dev/vda: 16.0 GB, 16000221184 bytes, 31250432 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: 0x0006c441
      
         Device Boot      Start         End      Blocks   Id  System
      /dev/vda1   *        2048     1026047      512000   83  Linux
      /dev/vda2         1026048    31250431    15112192   8e  Linux LVM
      
      Disk /dev/vdb: 200.0 GB, 200000143360 bytes, 390625280 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 /dev/mapper/centos_lab--lnx--centos-root: 13.8 GB, 13828620288 bytes, 27009024 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 /dev/mapper/centos_lab--lnx--centos-swap: 1602 MB, 1602224128 bytes, 3129344 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
      
      1 Reply Last reply Reply Quote 1
      • scottalanmillerS
        scottalanmiller
        last edited by

        If you wish to use the parted command, you can learn more about Parted on Tecmint for interactive usages.

        scottalanmillerS 1 Reply Last reply Reply Quote 1
        • scottalanmillerS
          scottalanmiller @scottalanmiller
          last edited by

          Some additional resultant LVM info for those that may be interested:

          pvs
            PV         VG                    Fmt  Attr PSize   PFree 
            /dev/vda2  centos_lab-lnx-centos lvm2 a--   14.41g 40.00m
            /dev/vdb   vol_data1             lvm2 a--  186.26g     0 
          
           vgs
            VG                    #PV #LV #SN Attr   VSize   VFree 
            centos_lab-lnx-centos   1   2   0 wz--n-  14.41g 40.00m
            vol_data1               1   1   0 wz--n- 186.26g     0 
          
          lvs
            LV       VG                    Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
            root     centos_lab-lnx-centos -wi-ao----  12.88g                                                    
            swap     centos_lab-lnx-centos -wi-ao----   1.49g                                                    
            lv_data1 vol_data1             -wi-ao---- 186.26g
          
          1 Reply Last reply Reply Quote 1
          • scottalanmillerS
            scottalanmiller
            last edited by

            Here is what df looks like...

            df -h
            Filesystem                                Size  Used Avail Use% Mounted on
            /dev/mapper/centos_lab--lnx--centos-root   13G  1.6G   12G  12% /
            devtmpfs                                  2.0G     0  2.0G   0% /dev
            tmpfs                                     2.0G     0  2.0G   0% /dev/shm
            tmpfs                                     2.0G  8.4M  2.0G   1% /run
            tmpfs                                     2.0G     0  2.0G   0% /sys/fs/cgroup
            /dev/vda1                                 497M  184M  313M  38% /boot
            tmpfs                                     396M     0  396M   0% /run/user/0
            tmpfs                                     396M     0  396M   0% /run/user/1101
            /dev/mapper/vol_data1-lv_data1            187G   33M  187G   1% /data
            
            1 Reply Last reply Reply Quote 1
            • StrongBadS
              StrongBad
              last edited by

              Not really all that specific to XFS, switching to ext4 or something else would be easy.

              1 Reply Last reply Reply Quote 1
              • scottalanmillerS
                scottalanmiller
                last edited by

                Yes, just need to alter the mkfs command and the settings in /etc/fstab.

                1 Reply Last reply Reply Quote 0
                • StrongBadS
                  StrongBad
                  last edited by

                  Is there a good reason to be using the raw device rather than making partitions on it like you normally would with parted?

                  scottalanmillerS 1 Reply Last reply Reply Quote 0
                  • antonitA
                    antonit
                    last edited by

                    Very nice.

                    scottalanmillerS 1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller @antonit
                      last edited by

                      @antonit said:

                      Very nice.

                      Thanks

                      1 Reply Last reply Reply Quote 0
                      • scottalanmillerS
                        scottalanmiller @StrongBad
                        last edited by

                        @StrongBad said:

                        Is there a good reason to be using the raw device rather than making partitions on it like you normally would with parted?

                        It makes things more flexible in case you decide to change the size of the underlying block device. LVM will grow more easily and can do the partioning that you need on top using new LVs instead of needing to create hard partitions.

                        1 Reply Last reply Reply Quote 1
                        • scottalanmillerS
                          scottalanmiller
                          last edited by

                          I just used this myself to make a new block device in a single line. Awesome 🙂

                          1 Reply Last reply Reply Quote 0
                          • 1 / 1
                          • First post
                            Last post