1

I am new to Ubuntu after a long time of putting it off. Over the past few months I have gone from a complete novice to running my own home server with nginx and php-fpm and my website is working great. Covered all aspects from mysql to SSL with a little help from users here.

I even lost my whole /etc/ directory which I managed to come back from.

This is all from my desktop computer.

Ok enough chit chat I bought a server rack and now wanting to transfer my server to it.

I have Ubuntu server 14.04 on my desktop with my working website and Ubuntu server 14.04 on the new server rack.

I like the idea of taring my server and then extracting it however I am running into problems everytime.

I was following this guide HERE

Now I decided I would miss step 1 and jump to step 2 as I was going to use SCP or rsyncto transfer the final tar.

When I entered

tar -cvzf ~/clone.tgz --exclude ~/clone.tgz /etc /home /opt /tmp /usr /var

and transferred the tar to my rack and extract it didn't boot so I relooked at the command.

I tried

tar -cvzf ~/clone.tgz --exclude ~/clone.tgz --exclude=/mnt --exclude=/etc/fstab  /etc /home /opt /tmp /usr /var

And the rack booted but not to system it complained about network and waiting 60 seconds more then black screen.

I figured that I need to be excluding network files also. I then tried..

tar -cvzf ~/clone.tgz --exclude ~/clone.tgz --exclude=/mnt --exclude=/etc/fstab exclude=/etc/modules exclude=/etc/lilo.conf exclude=/etc/mtab exclude=/proc exclude=/dev exclude=/var/log exclude=/etc/network/interfaces exclude=/etc/hostname  /etc /home /opt /tmp /usr /var

That still didn't work. So I figured that maybe there is more network files I need to be excluding or I am doing things in the wrong order.

I tried putting the tarred directories before the excluded files/folders that still didn't work and I also tried putting ./ before the allowed directories and also putting quotes around the excluded paths eg..

--exclude='/etc/fstab'

I was getting errors after tar so I removed the verbose option and seen that they were files that wasn't entirely important so now I figure that I must be needing to add more locations to exclude.

I must note that after removing the verbose option it did say..

Removing leading / from member names

And

Removing leading / from hard link targets

But after a bit of research that is supposed to happen

Any help would be great as it will save me going bald due to pulling my hair out :D

Best regards

2
  • 1
    Not an answer but wouldn't it be easier to transfer just the website data, not the whole OS as well?
    – Jos
    Dec 2, 2014 at 12:07
  • I tried rsync data but end up with permission errors all the time. Which us why I am in favour of doing it this way. On the box it appears very easy to do and I'm sure I'm just missing a small detail. Also it's knowing what data to transfer as I'm trying to move mysql data and everything.
    – Jinxzy
    Dec 2, 2014 at 12:10

1 Answer 1

1

The best solution would be to setup everyting again on the server and copy only the "production data". (You should document your setup, so that you can recreate it whenever necessary and only need backups for restoring production data.)

Restoring parts of an operating system to another existing system is a bad idea and will result in inconsistencies. For example copying contents of /usr from a desktop system to a server system will install contents without informing the package management system and will not update them with security updates. You should install the packages through the package manager instead. Copying /tmp on the other hand is almost pointless, because it is usually wiped upon reboot.

Backing up and restoring a machine from a tar archive is meant for clean drives/partitions, where it is easy and just involves restoring data, writing the boot loader and probably replacing filesystem UUIDs.

3
  • Might not have explained my setup correctly does that even apply if I have Ubuntu server 14.04 on both machines? My use of "desktop" was incorrect
    – Jinxzy
    Dec 2, 2014 at 13:07
  • 1
    @Jinx13 You should know what you are doing. Just copying configuration files is probably safe, but copying program files that you installed on one machine through package management should be installed on the other in the same way. For configuration files like int /etc you can use tools like diff or meld. Having so called recipies for applications you test on your desktop and deploy on your server is what you should focus on instead of restoring entire operating systems.
    – LiveWireBT
    Dec 2, 2014 at 13:54
  • Yes thank you. I took the plunge using my very few notes I made and started fresh. All actually went smoothly. Thank you everyone
    – Jinxzy
    Dec 4, 2014 at 20:14

You must log in to answer this question.

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