Yesterday I needed to completely re-partition a server (going from 12 separate partitions on /dev/sda to a two-disk setup with LVM). In order to have ensure data-integrity I booted from a live CD (Knoppix), mounted the old partitions inside /mnt and mounted the new (target) partitions in /mnt2.
The mounts inside /mnt2 looked the following:
Once I synced /mnt to /mnt2, I mounted procfs, sysfs and dev into /mnt2:
mount --bind /dev /mnt2/dev
mount --bind /proc /mnt2/proc
mount --bind /sys /mnt2/sys
And then went into the "new system":
chroot /mnt2 /bin/bash
I adapted /etc/fstab to have the new UUID's of the real partitions and the logical volumes pointing to the correct mount points. And then I knew I had to create a new initramfs because I now use LVM. But none of the lvm commands worked, because lvm2 was not installed. So I configured the network card and wanted to run apt-get install lvm2 but got errors from apt that the dns resolution didn't work.
I checked /etc/resolv.conf and it was a symlink:
/etc/resolv.conf -> ../run/resolvconf/resolv.conf
Of course ../run was empty. And even when I added it with yet another bind mount inside /mnt2, the resolvconf folder didn't exist of course (/run was mounted from the Knoppix live image and resolvconf inside chroot wasn't started).
Because my maintenance window narrowed, I deleted the symlink and simply created a plain simple /etc/resolv.conf with a nameserver entry. With that change I was finally able to run apt-get install lvm2. Once this package was installed, it automatically updated the initramfs. Well, thanks! Note: I would have run "update-initramfs -u" if apt didn't do it automatically.
The only thing left was to update the GRUB bootloader:
This generated the new grub config file in /boot/grub/grub.cfg. And then install the bootloader itself on the new OS disk:
TL;DR: resolvconf package may be helpful in a "normal" start of the OS, but when doing some maintenance tasks as I did (in a rescue or repair mode) then a classic and static /etc/resolv.conf file does the job better because it does not depend on another script (resolvconf).
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Icingaweb Icingaweb2 Influx Internet Java KVM Kibana Kodi Kubernetes LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder