[YLUG] Upgrading best-practice

mike cloaked mike.cloaked at gmail.com
Tue Jun 8 07:33:20 UTC 2010


On Tue, Jun 8, 2010 at 12:03 AM, john halewood <john.halewood at gmail.com> wrote:
> On 7 June 2010 22:28, Steve Almond <steve at silkandslug.com> wrote:
>> Hi all,
>>
>> I'm almost embarrassed to mention it, as it sounds horribly un-techie,
>> but my current Linux-based problem is regards upgrading. More
>> specifically, I want to upgrade a headless server from Ubuntu 10.4 on
>> two partitions (/ and /home) to Debian (or Ubuntu 10.10 or whatever) on
>> at least two partitions. I've looked at it a couple of times, but my
>> research only gets so far before it bogs down in partitioning scheme
>> dogma, upgrading verses installing, worries about upgrading config files
>> while keeping settings, etc.
>
> I had to do something similar when upgrading a machine from 8.04 to
> 10LTS and ran out of disk space on the original partition. Fortunately
> there was more disk space available. If you have enough disk space,
> just upgrade - the upgrade will ask you if you want to keep your
> settings for existing apps and give you the opportunity to replace or
> merge them - this should be fairly straightforward but will require
> manual intervention during the upgrade process. /home shouldn't be
> touched at all.
> In my case there wasn't enough space on / or /var, so I had to telinit
> 1, cp -a /var and /usr to new partitions, change /etc/fstab to reflect
> that and then upgrade. Went alright after that - just don't lose the
> ssh connection.
> YMMV. Good luck.

I guess that there are as many answer as people who will be able to
answer - hence the bogging down in indecision! However there are some
pointers from the way I do things when moving from one version to
another.

Over time I have come to the conclusion that for many people upgrading
generates as much work after the upgrade, or even more, than doing a
clean install and re-configuring - however it is possible to minimise
the post-install work by good preparation beforehand.

You did not say how much space you have on your HD but the way I work
is as follows.

Firstly before any upgrading at all I make sure that I have a good
backup of all data in /home /opt as well as /root /boot/grub /var and
/etc  and in fact I have a partition called /opt under which I have
/opt/Local  and in there I place /opt/Local/backup for all the
directories I just mentioned.  Also I make /opt/Local/home which I
bind mount to /home and that way only need / and /opt

Another analogous scheme is to keep /home as a partition and then make
/home/opt and symlink to /opt again meaning you only need two main
partitions.  What I then do for upgrade is to do a clean install with
/ being reformatted during the install, and leaving /opt untouched but
making it a mount point during the install.

For a headless machine can you get a monitor plugged in temporarily to
do the install and then remove it later?  That makes life easy.  Also
when doing an upgrade (I am a Fedora man)  - I put the DVD iso install
file into /opt/Local/isos/ and then loop mount the iso and pull out
the images directory, placing it in the same directory as the iso
file.  Whilst I am at it I then pull the vmlinuz and initrd.img files
into /boot/grub and then edit /boot/grub/grub.conf to add a stanza to
boot the install using these two files.  Once that is done I can then
simply reboot the machine and select that newly made grub install
entry - and then select a hard drive install and point it at the iso
in the /opt partition.  That way I am not then dependent on the
network during the install and the initial install takes typically
around 20 minutes on a reasonably modern machine.  Maybe up to 35
minutes on an older machine. After firstboot I always then yum update
to the latest package versions and install any additional repos and
other packages I need. Since I build my own DVD install isos (which
were previously advertised to this list as available) then this update
is usually fairly trivially fast.

The next stage is to link up all the user areas with the new system -
if there is a single non-root user then I usually let it use a newly
created user area. I move the new /home / and I bind mount
/opt/Local/home to /home.DIST and make a new /home which I bind mount
to /opt/Local/home and then copy out the new user area from /home.DIST
to the new /home and then all other user top directories are already
then in place in /home from the previous system.  You do have to pay
attention to SELinux contexts and make sure that restorecon is used
where necessary to keep the contexts correct. The user entries for
/etc/passwd /etc/shadow /etc/group and /etc/gshadow need to be updated
to add in any other users to that their original home directories are
recognised by the new system.

So once the install is done, and the user entries are back in place,
it is easy to edit the main system configs since they are now already
on the local disk from the previous system in /opt/Local/backups, and
the bits I need can easily be placed in the files on the new system.
Using this technique I am usually up and running from the start of the
new install in about two and a half hours. The main system changes
that I need are for bind, dhcp, ntp, firewall, dovecot imap server,
and any web server configs.

If you cannot put in place a monitor for the install then you can do a
vnc install (in Fedora at least) and connect another machine to the
headless server during the initial setup in anaconda. The techniques
are detailed in the Fedora install guide at:
http://docs.fedoraproject.org/en-US/Fedora/13/html/Installation_Guide/index.html
and in particular navigating to the section:
http://docs.fedoraproject.org/en-US/Fedora/13/html/Installation_Guide/sn-remoteaccess-installation.html

I presume that this kind of access is also made available in other
flavours of Linux but no doubt other list members will confirm/deny
for Ubuntu etc?

By the way about a year ago I moved all my machines over the ext4
filesystems and to do that I needed to ensure that my /opt partition
was on an external usb drive for each machine made as part of my
normal backup routine (using rsync).  Then when I started the installs
I had to place the isos on a different partition than the ones that I
was about to reformat, including /opt!  Then the install I allowed to
reformat both / and /opt as ext4 and once the install was complete my
first act was to copy back the backup /opt files onto the new /opt
partition from the backup drive.

In the case of one netbook without an optical drive I kicked off the
new install by using a bootable usbkey with the DVD iso on it - that
is again documented in the Fedora lists forum.

I hope this helps.

Mike

-- 
mike c



More information about the York mailing list