如何安装一个全新的逻辑卷?

如何安装一个全新的逻辑卷?

全新硬盘 (/dev/sdb)。上面没有数据(几乎可以尝试任何方法)。Ubuntu 20.04。由于我的主驱动器是 SSD,我决定创建一个新的卷组 hdd-vg。我创建了 VG、LV 和 PG,看似成功了(见下文),但每当我尝试挂载它或将其放入 fstab 时,我都会收到错误。它需要格式化吗?

# 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.

在下面的数据中,我经常排除系统上其他驱动器/逻辑驱动器的信息。

# 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

答案1

您是否为 lvm 创建了文件系统???

sudo mkfs -t ext4 /dev/mapper/hdd--vg-hdd--lv1
(ext4 或任何你选择使用的文件系统)

相关内容