root@masadmin:~# lsblk
NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0                       7:0    0    62M  1 loop /snap/core20/1587
loop1                       7:1    0  79.9M  1 loop /snap/lxd/22923
loop3                       7:3    0  40.4M  1 loop /snap/snapd/20671
loop4                       7:4    0 111.9M  1 loop /snap/lxd/24322
sda                         8:0    0    50G  0 disk
├─sda1                      8:1    0     1M  0 part
├─sda2                      8:2    0     2G  0 part /boot
└─sda3                      8:3    0    48G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0    48G  0 lvm  /
sdb                         8:16   0   100G  0 disk
sr0                        11:0    1  1024M  0 rom
root@masadmin:~#

root@masadmin:~# cfdisk /dev/sdb












                                            l Select label type qqqk
                                            x gpt                  x
                                            x dos                  x
                                            x sgi                  x
                                            x sun                  x
                                            mqqqqqqqqqqqqqqqqqqqqqqj














                             Device does not contain a recognized partition table.
                 Select a type to create a new label, press 'L' to load script file, 'Q' quits.

                                                 Disk: /dev/sdb
                              Size: 100 GiB, 107374182400 bytes, 209715200 sectors
                          Label: gpt, identifier: 5BB703BC-51C0-334C-AE4D-45750F836340

    Device                        Start                End            Sectors           Size Type
>>  Free space                     2048          209715166          209713119           100G


























                           [   New  ]  [  Quit  ]  [  Help  ]  [  Write ]  [  Dump  ]


                                      Create new partition from free space

                                                 Disk: /dev/sdb
                              Size: 100 GiB, 107374182400 bytes, 209715200 sectors
                          Label: gpt, identifier: 5BB703BC-51C0-334C-AE4D-45750F836340

    Device                        Start                End            Sectors           Size Type
>>  Free space                     2048          209715166          209713119           100G


























 Partition size: 100G


                     May be followed by M for MiB, G for GiB, T for TiB, or S for sectors.

                                                 Disk: /dev/sdb
                              Size: 100 GiB, 107374182400 bytes, 209715200 sectors
                          Label: gpt, identifier: 20B40C7E-E107-3748-9B59-54D03AF36F87

    Device                      Start               End           Sectors          Size Type
>>  /dev/sdb1                    2048         209715166         209713119          100G Linux filesystem






















 lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
 xPartition UUID: 10E31D42-E6C4-0B47-9DF4-A4A4A9A222B1                                                        x
 xPartition type: Linux filesystem (0FC63DAF-8483-4772-8E79-3D69D8477DE4)                                     x
 mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
               [ Delete ]  [ Resize ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]  [  Dump  ]

                                        l Select partition type qqqqqqqk
                                        x EFI System                   x
                                        x MBR partition scheme         x
                                        x Intel Fast Flash             x
                                        x BIOS boot                    x
                                        x Sony boot partition          x
                                        x Lenovo boot partition        x
                                        x PowerPC PReP boot            x
                                        x ONIE boot                    x
                                        x ONIE config                  x
                                        x Microsoft reserved           x
                                        x Microsoft basic data         x
                                        x Microsoft LDM metadata       x
                                        x Microsoft LDM data           x
                                        x Windows recovery environment x
                                        x IBM General Parallel Fs      x
                                        x Microsoft Storage Spaces     x
                                        x HP-UX data                   x
                                        x HP-UX service                x
                                        x Linux swap                   x
                                        x Linux filesystem             x
                                        x Linux server data            x
                                        x Linux root (x86)             x
                                        x Linux root (x86-64)          x
                                        x Linux root (ARM)             x
                                        x Linux root (ARM-64)          x
                                        x Linux root (IA-64)           x
                                        x Linux reserved               x
                                        x Linux home                   x
                                        x Linux RAID                   x
                                        x Linux LVM                    x
                                        x Linux variable data          x
                                        x Linux temporary data         x
                                        mqqqqqqqqqqqqqqqqqqqqqqqqqqqq↓qj

                                      E6D6D379-F507-44C2-A23C-238F2A3DF928

                                                 Disk: /dev/sdb
                              Size: 100 GiB, 107374182400 bytes, 209715200 sectors
                          Label: gpt, identifier: 20B40C7E-E107-3748-9B59-54D03AF36F87

    Device                        Start                End            Sectors           Size Type
>>  /dev/sdb1                      2048          209715166          209713119           100G Linux LVM






















 lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
 xPartition UUID: 10E31D42-E6C4-0B47-9DF4-A4A4A9A222B1                                                        x
 xPartition type: Linux LVM (E6D6D379-F507-44C2-A23C-238F2A3DF928)                                            x
 mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
               [ Delete ]  [ Resize ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]  [  Dump  ]

                                          Changed type of partition 1.

                                                 Disk: /dev/sdb
                              Size: 100 GiB, 107374182400 bytes, 209715200 sectors
                          Label: gpt, identifier: 20B40C7E-E107-3748-9B59-54D03AF36F87

    Device                        Start                End            Sectors           Size Type
>>  /dev/sdb1                      2048          209715166          209713119           100G Linux LVM






















 lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
 xPartition UUID: 10E31D42-E6C4-0B47-9DF4-A4A4A9A222B1                                                        x
 xPartition type: Linux LVM (E6D6D379-F507-44C2-A23C-238F2A3DF928)                                            x
 mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
 Are you sure you want to write the partition table to disk?


                             Type "yes" or "no", or press ESC to leave this dialog.

                                                 Disk: /dev/sdb
                              Size: 100 GiB, 107374182400 bytes, 209715200 sectors
                          Label: gpt, identifier: 20B40C7E-E107-3748-9B59-54D03AF36F87

    Device                        Start                End            Sectors           Size Type
>>  /dev/sdb1                      2048          209715166          209713119           100G Linux LVM






















 lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
 xPartition UUID: 10E31D42-E6C4-0B47-9DF4-A4A4A9A222B1                                                        x
 xPartition type: Linux LVM (E6D6D379-F507-44C2-A23C-238F2A3DF928)                                            x
 mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
               [ Delete ]  [ Resize ]  [  Quit  ]  [  Type  ]  [  Help  ]  [  Write ]  [  Dump  ]


                                      Quit program without writing changes

root@masadmin:~# cfdisk /dev/sdb

Syncing disks.
root@masadmin:~#
root@masadmin:~#

root@masadmin:~# lsblk
NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0                       7:0    0    62M  1 loop /snap/core20/1587
loop1                       7:1    0  79.9M  1 loop /snap/lxd/22923
loop3                       7:3    0  40.4M  1 loop /snap/snapd/20671
loop4                       7:4    0 111.9M  1 loop /snap/lxd/24322
sda                         8:0    0    50G  0 disk
├─sda1                      8:1    0     1M  0 part
├─sda2                      8:2    0     2G  0 part /boot
└─sda3                      8:3    0    48G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0    48G  0 lvm  /
sdb                         8:16   0   100G  0 disk
└─sdb1                      8:17   0   100G  0 part
sr0                        11:0    1  1024M  0 rom
root@masadmin:~#
root@masadmin:~#

root@masadmin:~# vgs
  VG        #PV #LV #SN Attr   VSize   VFree
  ubuntu-vg   1   1   0 wz--n- <48.00g    0
root@masadmin:~#
root@masadmin:~# pvs
  PV         VG        Fmt  Attr PSize   PFree
  /dev/sda3  ubuntu-vg lvm2 a--  <48.00g    0
root@masadmin:~#
root@masadmin:~# lvs
  LV        VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- <48.00g
root@masadmin:~#
root@masadmin:~#

root@masadmin:~# lsblk
NAME                      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0                       7:0    0    62M  1 loop /snap/core20/1587
loop1                       7:1    0  79.9M  1 loop /snap/lxd/22923
loop3                       7:3    0  40.4M  1 loop /snap/snapd/20671
loop4                       7:4    0 111.9M  1 loop /snap/lxd/24322
sda                         8:0    0    50G  0 disk
├─sda1                      8:1    0     1M  0 part
├─sda2                      8:2    0     2G  0 part /boot
└─sda3                      8:3    0    48G  0 part
  └─ubuntu--vg-ubuntu--lv 253:0    0    48G  0 lvm  /
sdb                         8:16   0   100G  0 disk
└─sdb1                      8:17   0   100G  0 part
sr0                        11:0    1  1024M  0 rom
root@masadmin:~#

root@masadmin:~# vgcreate datavg /dev/sdb1
  Physical volume "/dev/sdb1" successfully created.
  Volume group "datavg" successfully created
root@masadmin:~#
root@masadmin:~# vgs
  VG        #PV #LV #SN Attr   VSize    VFree
  datavg      1   0   0 wz--n- <100.00g <100.00g
  ubuntu-vg   1   1   0 wz--n-  <48.00g       0
root@masadmin:~#
root@masadmin:~# lvs
  LV        VG        Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  ubuntu-lv ubuntu-vg -wi-ao---- <48.00g
root@masadmin:~# pvs
  PV         VG        Fmt  Attr PSize    PFree
  /dev/sda3  ubuntu-vg lvm2 a--   <48.00g       0
  /dev/sdb1  datavg    lvm2 a--  <100.00g <100.00g
root@masadmin:~#
root@masadmin:~# lvcreate -l 100%FREE datavg -n datalv
  Logical volume "datalv" created.
root@masadmin:~#
root@masadmin:~# vgs
  VG        #PV #LV #SN Attr   VSize    VFree
  datavg      1   1   0 wz--n- <100.00g    0
  ubuntu-vg   1   1   0 wz--n-  <48.00g    0
root@masadmin:~# lvs
  LV        VG        Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  datalv    datavg    -wi-a----- <100.00g
  ubuntu-lv ubuntu-vg -wi-ao----  <48.00g
root@masadmin:~#

root@masadmin:~# mkfs.ext4 /dev/mapper/datavg-datalv
mke2fs 1.46.5 (30-Dec-2021)
Creating filesystem with 26213376 4k blocks and 6553600 inodes
Filesystem UUID: 8d8b142f-9edd-4c63-9094-d145e2a7a5c9
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 (131072 blocks): done
Writing superblocks and filesystem accounting information: done

root@masadmin:~#
root@masadmin:~# mkdir /data
root@masadmin:~#
root@masadmin:~# df -hT
Filesystem                        Type   Size  Used Avail Use% Mounted on
tmpfs                             tmpfs  1.6G  1.5M  1.6G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4    47G  8.2G   37G  19% /
tmpfs                             tmpfs  7.8G     0  7.8G   0% /dev/shm
tmpfs                             tmpfs  5.0M     0  5.0M   0% /run/lock
/dev/sda2                         ext4   2.0G  251M  1.6G  14% /boot
tmpfs                             tmpfs  1.6G  4.0K  1.6G   1% /run/user/1000
root@masadmin:~#

root@masadmin:~# mount /dev/mapper/datavg-datalv /data
root@masadmin:~#
root@masadmin:~# df -hT
Filesystem                        Type   Size  Used Avail Use% Mounted on
tmpfs                             tmpfs  1.6G  1.5M  1.6G   1% /run
/dev/mapper/ubuntu--vg-ubuntu--lv ext4    47G  8.2G   37G  19% /
tmpfs                             tmpfs  7.8G     0  7.8G   0% /dev/shm
tmpfs                             tmpfs  5.0M     0  5.0M   0% /run/lock
/dev/sda2                         ext4   2.0G  251M  1.6G  14% /boot
tmpfs                             tmpfs  1.6G  4.0K  1.6G   1% /run/user/1000
/dev/mapper/datavg-datalv         ext4    98G   24K   93G   1% /data
root@masadmin:~#

root@masadmin:~# echo "/dev/mapper/datavg-datalv /data ext4 defaults 0 0" >> /etc/fstab
root@masadmin:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-ZKcpMv7FsHa8P1y3bVL8NmdSFKdFRbu1U1wd0Si6pzv03WJkwBPIVNIw0wGF4Sno / ext4 defaults 0 1
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/a78ef55f-39af-4ee8-bd32-103c1fa5546c /boot ext4 defaults 0 1
/swap.img       none    swap    sw      0       0
/dev/mapper/datavg-datalv /data ext4 defaults 0 0
root@masadmin:~#

Leave a Reply

Your email address will not be published. Required fields are marked *