I have a Ubuntu 19-04 LVM installation I am wanting to convert to RAID 1 using this tutorial here:
Before I try this on my real system I want to see it working on a virtual machine. So I have created a Ubuntu 19-04 LVM virtual machine with a 250GB virtual disk on VirtualBox. I then created a second 250GB virtual disk.
After running:
sfdisk -d /dev/sda | sfdisk --force /dev/sdb
This is the output of 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
Both drives have exactly the same number of bytes and sectors.
When I got to this bit:
mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1
Terminal output was:
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?
I note this was not mentioned in the tutorial. Can anyone explain to me why I have got this message and what it means?
[Edit: According this this post this is nothing to worry about: https://www.howtoforge.com/how-to-set-up-software-raid1-on-a-running-lvm-system-incl-grub2-configuration-debian-squeeze-p2]
Anyway I said yes and carried on.
When I got to this bit:
pvmove -i 2 /dev/sda1 /dev/md0
Terminal output was:
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.
Both of these drives are exactly the same size so I do not understand why there would not be enough space.
What is the solution to this? Should I reduce the size of my logical volume? Reduce the size of the physical volume? Or something else?
Edit:
I thought I would try and reduce the size of the LVM so I booted in to a live CD. The output of:
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
When I tried
root@ubuntu:/home/ubuntu# resize2fs /dev/ubuntu-vg/root 248GB
I got:
resize2fs 1.44.6 (5-Mar-2019)
open: No such file or directory while opening /dev/ubuntu-vg/root