How do I mount a brand new logical volume?

Brand new hard drive (/dev/sdb). No data on it (can try most anything). Ubuntu 20.04. As my primary drive is an SSD, I decided to create a new volume group, hdd-vg. I created the VG, LV, and PG, seemingly successfully (see below) but whenever I try to mount it or put it in fstab, I get an error. Does it need to be formatted or something?

# mount /dev/mapper/hdd--vg-hdd--lv1 /mnt/hdd
mount: /mnt/hdd: wrong fs type, bad option, bad superblock on /dev/mapper/hdd--vg-hdd--lv1, missing codepage or helper program, or other error.

# mount /dev/hdd-vg/hdd-lv1 /mnt/hdd
mount: /mnt/hdd: wrong fs type, bad option, bad superblock on /dev/mapper/hdd--vg-hdd--lv1, missing codepage or helper program, or other error.

In the data below, I’ve often excluded the info for the other drive/logicals on the system.

# fdisk -l
Disk /dev/sdb: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: ST1000DM010-2EP1
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

Disk /dev/mapper/ubuntu--vg-root: 236.102 GiB, 254472617984 bytes, 497016832 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/ubuntu--vg-swap_1: 976 MiB, 1023410176 bytes, 1998848 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/hdd--vg-hdd--lv1: 931.52 GiB, 1000203091968 bytes, 1953521664 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


# vgdisplay
  --- Volume group ---
  VG Name               hdd-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               931.51 GiB
  PE Size               4.00 MiB
  Total PE              238467
  Alloc PE / Size       238467 / 931.51 GiB
  Free  PE / Size       0 / 0   
  VG UUID               M23YyM-NJQD-SkFS-Omat-5cxw-5Aeg-8hwzjm

# lvdisplay
  --- Logical volume ---
  LV Path                /dev/hdd-vg/hdd-lv1
  LV Name                hdd-lv1
  VG Name                hdd-vg
  LV UUID                ysuHKI-BYfZ-CcKF-3PGY-t66M-3CjW-jvcu9f
  LV Write Access        read/write
  LV Creation host, time brjarvis-desktop2, 2020-11-15 16:20:39 -0700
  LV Status              available
  # open                 0
  LV Size                931.51 GiB
  Current LE             238467
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sdb
  VG Name               hdd-vg
  PV Size               931.51 GiB / not usable 1.71 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238467
  Free PE               0
  Allocated PE          238467
  PV UUID               T8IQyK-dk3H-JBrh-Oi1X-2ede-QWOs-JPqHeQ

# lvscan
  ACTIVE            '/dev/hdd-vg/hdd-lv1' [931.51 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/root' [<237.00 GiB] inherit
  ACTIVE            '/dev/ubuntu-vg/swap_1' [976.00 MiB] inherit

# ls /dev/mapper -l
total 0
crw------- 1 root root 10, 236 Nov 15 15:41 control
lrwxrwxrwx 1 root root       7 Nov 15 16:20 hdd--vg-hdd--lv1 -> ../dm-2
lrwxrwxrwx 1 root root       7 Nov 15 15:41 ubuntu--vg-root -> ../dm-0
lrwxrwxrwx 1 root root       7 Nov 15 15:41 ubuntu--vg-swap_1 -> ../dm-1

# ls /dev/hdd* -l
total 0
lrwxrwxrwx 1 root root 7 Nov 15 16:20 hdd-lv1 -> ../dm-2
Asked By: walrii

||

Did you create a filesystem for the lvm???

sudo mkfs -t ext4 /dev/mapper/hdd--vg-hdd--lv1
(ext4 or whichever filesystem you choose to use)

Answered By: WU-TANG

Awesome it works like charm!! Thank you

Answered By: Rajabu Kitindi
Categories: Answers Tags: , , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.