1

I'm following this guide so I can download a copy of the disk image as I want to migrate to another host. When I get to the stage where this command needs to be entered:

ssh root@123.45.67.89 "dd if=/dev/xvda " | dd of=/home/archive/linode.img

(with the correct IP and a filepath of '/linode.img') I get a permission denied error, and I'm certain that I'm using the correct password as it works when normally logging in.

The strange thing is that it was working, but then after a disk image resize (I made it smaller as I was receiving an error saying there wasn't enough space when copying the image) it started giving me permission denied messages.

Ladadadada
  • 26,337
  • 7
  • 59
  • 90
Theo
  • 19
  • 1

1 Answers1

3

I'd argue that you're doing it wrong.

Here's what I'd do:

Debian/Ubuntu

On the old server

sudo dpkg --get-selections > package-selections
scp package-selections new-server:~/package-selections

On the new server

sudo dpkg --set-selections < package-selections
sudo apt-get update && sudo apt-get -u dselect-upgrade

RedHat/Centos/ScientificLinux/etc.:

rpm -qa > package-selections

and to restore

yum -y install $(cat package-selections)

That'll install the packages that were on the old server, on the new server.

Then the remaining thing to do is to use rsync to copy the contents of /home and /var/www over

I'd also copy over a copy of /etc/ but not push it into place automatically. Instead, rsync it to /home/yourname/etc and cherry pick stuff out of it.

Alternatively, use puppet.

Tom O'Connor
  • 27,480
  • 10
  • 73
  • 148
  • Would this work for Drupal and Aegir installations? – Theo Nov 02 '12 at 14:09
  • 1
    That depends where they're installed into. I'm trying to make the point that it's a bad idea to just blindly copy an entire image, I'd rather build a new server from the same packages that were used to create the first one. – Tom O'Connor Nov 02 '12 at 14:26
  • Oh okay, I wasn't planning to restore directly from this image, rather just download it so I have a local copy of _everything_ before I close my account. – Theo Nov 02 '12 at 14:34
  • Oh.. In that case, why not just tar up /? – Tom O'Connor Nov 02 '12 at 14:49
  • You can probably tell I'm quite new to all of this, I just did a quick search trying to find how to get a local copy of everything on my server and that guide came up. I'll look into doing that instead, thanks. – Theo Nov 02 '12 at 14:54