我正在尝试了解 LVM 并向 Linux 机器添加磁盘。我添加了一个磁盘,然后运行了我认为的命令来将该磁盘添加到盒子中,但我认为我搞砸了。
我是否刚刚将此磁盘添加到当前 LV,现在只需要调整它的大小?我尝试安装它,但返回时出现以下错误。
安装错误..
mount -t xfs /dev/mapper/ol-lv_oradata /mnt/drives/oradata
mount: wrong fs type, bad option, bad superblock on /dev/mapper/ol-lv_oradata,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so.
这是我的输出。
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ol-root 27G 22G 5.1G 81% /
devtmpfs 1.4G 0 1.4G 0% /dev
tmpfs 1.4G 32M 1.4G 3% /dev/shm
tmpfs 1.4G 9.6M 1.4G 1% /run
tmpfs 1.4G 0 1.4G 0% /sys/fs/cgroup
/dev/sda1 497M 282M 216M 57% /boot
tmpfs 276M 60K 276M 1% /run/user/54321
ls -ls /dev/sd*
0 brw-rw----. 1 root disk 8, 0 Jan 2 16:34 /dev/sda
0 brw-rw----. 1 root disk 8, 1 Jan 2 16:34 /dev/sda1
0 brw-rw----. 1 root disk 8, 2 Jan 3 13:53 /dev/sda2
0 brw-rw----. 1 root disk 8, 16 Jan 3 13:50 /dev/sdb <-- this is the disk I added
0 brw-rw----. 1 root disk 8, 17 Jan 3 13:53 /dev/sdb1 <-- this is the disk I added
fdisk -l
Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 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: 0x0003e72b
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 62914559 30944256 8e Linux LVM
Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 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: 0x9a45daa3
Device Boot Start End Blocks Id System
/dev/sdb1 2048 104857599 52427776 83 Linux
Disk /dev/mapper/ol-root: 28.4 GB, 28420603904 bytes, 55508992 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/ol-swap: 3221 MB, 3221225472 bytes, 6291456 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/ol-lv_oradata: 53.7 GB, 53687091200 bytes, 104857600 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
lvmdiskscan
/dev/ram0 [ 16.00 MiB]
/dev/ol/root [ <26.47 GiB]
/dev/ram1 [ 16.00 MiB]
/dev/sda1 [ 500.00 MiB]
/dev/ol/swap [ 3.00 GiB]
/dev/ram2 [ 16.00 MiB]
/dev/sda2 [ 29.51 GiB] LVM physical volume
/dev/ol/lv_oradata [ 50.00 GiB]
/dev/ram3 [ 16.00 MiB]
/dev/ram4 [ 16.00 MiB]
/dev/ram5 [ 16.00 MiB]
/dev/ram6 [ 16.00 MiB]
/dev/ram7 [ 16.00 MiB]
/dev/ram8 [ 16.00 MiB]
/dev/ram9 [ 16.00 MiB]
/dev/ram10 [ 16.00 MiB]
/dev/ram11 [ 16.00 MiB]
/dev/ram12 [ 16.00 MiB]
/dev/ram13 [ 16.00 MiB]
/dev/ram14 [ 16.00 MiB]
/dev/ram15 [ 16.00 MiB]
/dev/sdb1 [ <50.00 GiB] LVM physical volume
这是我的 lsblk 的输出..
sda
|-sda1 xfs e86122cd-12b8-418a-af88-213c5f7cf198 /boot
`-sda2 LVM2_member aTcqdV-CreW-yf1R-Et4Z-FXDg-a30f-bTa8ua
|-ol-root xfs d3f701f6-bee6-4838-ad23-e004d6477e2a /
|-ol-swap swap 551085fa-4f56-474a-9fe4-926a50254506 [SWAP]
`-ol-lv_oradata xfs 40b962d1-ec00-44a1-8257-42d706c4839f
sdb
`-sdb1 LVM2_member Q6IQCo-bR9J-XowP-gYzN-Nvfc-HcTG-UZDlL4
`-ol-lv_oradata xfs 40b962d1-ec00-44a1-8257-42d706c4839f
pvs
以下是和vgs
的输出lvs
pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 ol lvm2 a-- <29.51g 36.00m
/dev/sdb1 ol lvm2 a-- <50.00g 0
vgs
VG #PV #LV #SN Attr VSize VFree
ol 2 3 0 wz--n- 79.50g 36.00m
lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
lv_oradata ol -wi-a----- 50.00g
root ol -wi-ao---- <26.47g
swap ol -wi-ao---- 3.00g
答案1
问:我是否刚刚将此磁盘添加到当前 LV,现在只需要调整它的大小?我尝试安装它,但返回时出现以下错误。
答:如果你想用新磁盘扩展当前的 LVM,首先你需要在新磁盘上创建分区,就像 @roaima 之前提到的那样,然后扩展 LVM 的当前卷组,然后扩展你的 LVM 磁盘。
参考 :
答案2
的输出pvs
显示您有两个物理分区分配给您的卷组ol
。的输出lvs
显示该卷组中有三个逻辑卷。
您的第一次mount
尝试是准确的,所以我怀疑您没有格式化它。
mkfs -t xfs /dev/mapper/ol-lv_oradata
mount -t xfs /dev/mapper/ol-lv_oradata /mnt/drives/oradata
顺便说一句,既然您正在学习 LVM,请注意,如果您丢失了任何一个您可能会丢失的磁盘一切在跨越它们的卷组中。 (阅读“RAID 0”磁盘配置的危险以了解一些详细信息。您的 VG 的配置方式大致相同。)