Update Grub after modifying fstab?
Volker Wysk
post at volker-wysk.de
Fri Jan 31 15:33:55 UTC 2020
Am Donnerstag, den 30.01.2020, 19:23 -0500 schrieb Jose I Diaz
Bardales:
>
> On 1/30/20 3:06 AM, Volker Wysk wrote:
> > Am Mittwoch, den 29.01.2020, 18:37 -0500 schrieb Jose I Diaz
> > Bardales:
> > > On 1/29/20 3:15 PM, Volker Wysk wrote:
> > > > Hi
> > > >
> > > > The ubuntu installer sets up LVM, when choosing encryption. I
> > > > want
> > > > to
> > > > rename the volume group. It is always set to "ubuntu-vg" by the
> > > > ubuntu
> > > > installer. I want to avoid volume group name clashes in the
> > > > future.
> > > >
> > > > In the process of doing this, the /etc/fstab file needs to be
> > > > changed.
> > > > Amongst other things, it contains the line for the root
> > > > filesystem.
> > > > For
> > > > instance:
> > > >
> > > > /dev/mapper/ubuntu--vg-root / ext4 errors=remount-ro 0 1
> > > >
> > > > Now "ubuntu-vg" shall be renamed to "desktop-vg":
> > > >
> > > > /dev/mapper/desktop--vg-root / ext4 errors=remount-ro 0 1
> > > >
> > > > Does this break the bootability of the system? In other words,
> > > > does
> > > > Grub need to be updated when changing /etc/fstab? The renaming
> > > > needs to
> > > > be done from a live/maintenance system, because otherwise the
> > > > VG to
> > > > be
> > > > renamed is being in use. (really?)
> > > >
> > > > From what I've learned, the following command sequence is
> > > > needed
> > > > to
> > > > make the system bootable again, in the case of an UEFI system.
> > > > The
> > > > system is mounted at /mnt/root:
> > > >
> > > > mount <boot/-partition> /mnt/root/boot
> > > > mount <boot/efi/-partition> /mnt/root/boot/efi
> > > > mount --rbind /dev /mnt/root/dev
> > > > mount --rbind /proc /mnt/root/proc
> > > > mount --rbind /sys /mnt/root/sys
> > > > chroot /mnt/root
> > > > update-initramfs -u
> > > > grub-install --target=x86_64-efi --efi-directory=/boot/efi --
> > > > bootloader-id=Desktop
> > > > update-grub
> > > >
> > > > So
> > > > - Is this necessary?
> > > > - Is the grub-install line correct?
> > > >
> > > >
> > > > Cheers,
> > > > Volker
> > >
> > > I am not 100 percent sure but I believe you can use the lvm
> > > utility
> > > to
> > > rename volume groups without the need to edit fstab.
> >
> > The fstab needs to be modified, since in it occurs the volume group
> > name. Maybe (I don't think so) the lvm tool does that, but then the
> > system still needs to be made bootable again. I think that,
> > otherwise,
> > the initramfs still contains the old volume group name.
> >
> > Volker
> >
> Hello Volker,
>
> I was curios about this and you are correct. I added 2 virtual
> hard-drives on my VM at work and created a logical volume, and I did
> have to modified the fstab file at the end.
>
> Let me point out that I am doing all this on VM with a OS already
> install and I am not using encryption.
>
> Hopefully someone with more experience can provide some suggestions.
I took the risk and renamed the volume group (with vgrename) and tried
the sequence:
chroot /mnt/root
update-initramfs -u
grub-install --target=x86_64-efi --efi-directory=/boot/efi \
--bootloader-id=Desktop
update-grub
The grub-install step produced an error message, but it works.
Cheers,
Volker
More information about the ubuntu-users
mailing list