我有一个Ubuntu19-04 LVM安装,我想在这里使用本教程将其转换为RAID 1:
在我的真实系统上尝试这个之前,我希望看到它在虚拟机上工作。因此,我在VirtualBox上创建了一个具有250 on虚拟磁盘的Ubuntu19-04LVM虚拟机。然后我创建了第二个250的虚拟磁盘。
跑完后:
sfdisk -d /dev/sda | sfdisk --force /dev/sdb这是fdisk -l的输出:
Disk /dev/sda: 250 GiB, 268435456000 bytes, 524288000 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3f9af72a
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 524285951 524283904 250G 8e Linux LVM
Disk /dev/sdb: 250 GiB, 268435456000 bytes, 524288000 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3f9af72a这两个驱动器的字节数和扇区完全相同。
当我谈到这一点时:
mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1终端产出是:
mdadm: Note: this array has metadata at the start and
may not be suitable as a boot device. If you plan to
store '/boot' on this device please ensure that
your boot-loader understands md/v1.x metadata, or use
--metadata=0.90
Continue creating array? 我注意到这一点在本教程中没有提到。有人能向我解释我为什么会收到这条信息吗?它意味着什么?
不管怎样,我答应了,继续说下去。
当我谈到这一点时:
pvmove -i 2 /dev/sda1 /dev/md0终端产出是:
root@Ubuntu19:/home/mike# pvmove -i 2 /dev/sda1 /dev/md0
Insufficient free space: 63991 extents needed, but only 63967 available
Unable to allocate mirror extents for ubuntu-vg/pvmove0.
Failed to convert pvmove LV to mirrored.这两个驱动器都是完全相同的大小,所以我不明白为什么没有足够的空间。
解决这个问题的办法是什么?我应该缩小逻辑卷的大小吗?缩小体积的大小?还是别的什么?
编辑:
我想我会尽量缩小LVM的大小,所以我启动了一个活动CD。产出:
root@ubuntu:/home/ubuntu# lvdisplay
WARNING: Device for PV FvC0uz-efgT-zqqB-NK3f-2yTZ-QWlO-vXuneh not found
rejected by a filter.
--- Logical volume ---
LV Path /dev/ubuntu-vg/root
LV Name root
VG Name ubuntu-vg
LV UUID RJi0Hn-fuk3-kEEe-xVeG-FqeJ-OUXR-iTpW8Y
LV Write Access read/write
LV Creation host, time ubuntu, 2019-04-15 08:25:48 +0000
LV Status NOT available
LV Size 249.01 GiB
Current LE 63747
Segments 1
Allocation inherit
Read ahead sectors auto
--- Logical volume ---
LV Path /dev/ubuntu-vg/swap_1
LV Name swap_1
VG Name ubuntu-vg
LV UUID JX3Scc-fGIM-e8Z1-zwY3-1ACM-U70M-m8OshG
LV Write Access read/write
LV Creation host, time ubuntu, 2019-04-15 08:25:48 +0000
LV Status NOT available
LV Size 976.00 MiB
Current LE 244
Segments 1
Allocation inherit
Read ahead sectors auto当我试着
root@ubuntu:/home/ubuntu# resize2fs /dev/ubuntu-vg/root 248GB我得到了:
resize2fs 1.44.6 (5-Mar-2019)
open: No such file or directory while opening /dev/ubuntu-vg/root发布于 2019-04-24 04:05:06
好吧我想明白了。
我跑完之后:
sfdisk -d /dev/sda | sfdisk --force /dev/sdb 在用fdisk更改分区类型之前,我启动了一个活动CD,并执行了以下操作:
ubuntu@ubuntu:~$ sudo su
root@ubuntu:/home/ubuntu# lvdisplay
--- Logical volume ---
LV Path /dev/ubuntu-vg/root
LV Name root
VG Name ubuntu-vg
LV UUID RJi0Hn-fuk3-kEEe-xVeG-FqeJ-OUXR-iTpW8Y
LV Write Access read/write
LV Creation host, time ubuntu, 2019-04-15 08:25:48 +0000
LV Status available
# open 0
LV Size 249.01 GiB
Current LE 63747
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/ubuntu-vg/swap_1
LV Name swap_1
VG Name ubuntu-vg
LV UUID JX3Scc-fGIM-e8Z1-zwY3-1ACM-U70M-m8OshG
LV Write Access read/write
LV Creation host, time ubuntu, 2019-04-15 08:25:48 +0000
LV Status available
# open 0
LV Size 976.00 MiB
Current LE 244
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
root@ubuntu:/home/ubuntu# e2fsck -f /dev/ubuntu-vg/root
e2fsck 1.44.6 (5-Mar-2019)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/ubuntu-vg/root: 201304/16326656 files (0.1% non-contiguous),
2764077/65276928 blocks
root@ubuntu:/home/ubuntu# resize2fs /dev/ubuntu-vg/root 247G
resize2fs 1.44.6 (5-Mar-2019)
Resizing the filesystem on /dev/ubuntu-vg/root to 65011712 (4k)
blocks.
The filesystem on /dev/ubuntu-vg/root is now 65011712 (4k) blocks
long.
root@ubuntu:/home/ubuntu# lvreduce -L 248G /dev/ubuntu-vg/root
WARNING: Reducing active logical volume to <248.82 GiB.
THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce ubuntu-vg/root? [y/n]: y
Size of logical volume ubuntu-vg/root changed from 249.01 GiB (63747
extents) to <248.82 GiB (63697 extents).
Logical volume ubuntu-vg/root successfully resized.
root@ubuntu:/home/ubuntu# 回到我的虚拟机,在那之后,一帆风顺。
https://askubuntu.com/questions/1136260
复制相似问题