2

I am downgrading an existing ubuntu 10.04 LTS Virtual Server to one with less memory and a smaller drive ( from 80GB to 40GB ). My hoster ( hetzner.de ) does not give me the possibility of doing an inplace downgrade, so I have to create a new server. What is the best way to make an image of the first system and "apply it" to the new one ? I know there other answer but in my situation I am not sure I would be able to use Clonezilla or other GUI tools, because the installation is minimal with no GUI.

Thanks in advance

Michele

2
  • What services are you running ? Apache ? mysql ?
    – Panther
    Mar 29, 2012 at 20:44
  • I use it mainly for my blog, so I have: apache2, mysqld, and also vsftpd.
    – castigli
    Apr 1, 2012 at 4:13

3 Answers 3

2

This sounds like a job for, queue music; Rsync!

Edit: I mis-read the question, so let me update;

This sounds like a job for, queue music; Tar and Rsync!

4
  • Jeff, thanks for the tip. Actually, I was thinking to use only TAR, but I am no linux expert and It's the first I am doing this and I have many doubts. Anyway… By using "aptitude update", I already upgraded the base installation of the new server to Ubuntu 10.04.4, same as old, so that they have the same "baseline". So may be you can correct me. I would: 1) tar the full contents of the first server, excluding some dirs ( not sure what ). I imagine I have to stop apache, sql, etc.. in order to avoid files in use or already changing.
    – castigli
    Mar 30, 2012 at 15:13
  • 2) transfer the archive to the new server. 3) extract the archive overwriting all files. Here are my doubts: what if I can not overwrite files which are in use ? Can I overwriting them on the next restart. like in Windows :) ? May be rsync can help me ? Thanks
    – castigli
    Mar 30, 2012 at 15:13
  • Well, we could cheat.. If you have a LiveCD, pop it in the destination and boot from it. Doesn't matter what version liveCD it is as long as it has rsync. By doing this, the system on the destination drive is effectively shutdown so you can extract without worrying about overwriting files in use. Then you take out the LiveCD, reboot, and sunshine and lollipops fall from the sky ;) Mar 31, 2012 at 2:48
  • Thanks Jeff, at the end I used both TAR and RSYNC, as you can see below. When I'll have more reputation, I'll mark your answer as useful.
    – castigli
    Apr 4, 2012 at 9:33
1

I did the downgrade in this way.

First of all I upgraded the old system by using "aptitude update" and "aptitude upgrade". So that the version was 10.04.4.

Then I archived with TAR utility the whole disk of the old system. I did it while the old system was online and stored the resulting archive on the old system.

Then I created a new base virtual machine with the webhoster utilites. At this point I had the problem to be able to overwrite existing files which were in use. So I needed to have a sort of Live Cd ( like Jeff suggested above )

Not being able to boot from a live CD, I used the webhoster rescue system to have a similar effect. When you boot into this, you can mount read and write the actual system.

So I expanded with TAR the archive in a /NEW directory, and then I copied the varioust dir like var, usr, ... etc.. I renamed the existing with the suffix OLD. Then I rebooted, hoping that all was ok. There we some problems, however.

On the first reboot, the drive could not be mounted. The reason was that on the new system the drive was formatted with EXT4, while in /etc/fstab there were the settings of the old system, which was EXT3. So I rebooted again in the rescue system and take the original fstab in the new system.

At the next reboot, drives were mounted, however the system could not get an IP address.

The reason was that, since I had completely overwritten the /etc dir also network config. I did not know how to reconfigure, so I grep to find in the text files eth0. I found many entries, but the one to fix was the one referring to the MAC address. Once restored to the actual MAC address of the interface of the new system network was working again.

OK, now I tested if apache and mysql were working. None of them was working.

It turned out to be a problem of permissions. I am not sure about this, may be I forgot to add the p prefix to TAR ( which should preserve permissions )

In order to avoid setting permission manually, I used this time RSYNC to copy again the files from the old server. It seemed that RSYNC restored the permission, because after this I could start my blog.

Now another error is logged related to log rotating. Sure it's again a problem of permission.

At the end, sure I think my method was not very professional, that was the reason I asked here :)

1
  • Thanks for documenting the method you ended up choosing :) Apr 4, 2012 at 12:00
0

First back up your mysql database

mysqldump --add-drop-table -h mysqlhostserver -u mysqlusername -p databasename (tablename tablename tablename) | bzip2 -c > blog.bak.sql.bz2

For additional options see: http://codex.wordpress.org/Backing_Up_Your_Database

Then archive (tar) , include /etc , /var/www , and any other data you might have for your ftp server (I assume you use it for updating wordpress).

Transfer the archive to your new server and restore your mysql database and any data and custom settings in /etc (apache).

1
  • thanks, but I need(ed) a way to transfer the whole content of the system at once, without having to recovery every services. I found a way, may be not optimal, I will post it later.
    – castigli
    Apr 2, 2012 at 11:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .