You can copy a disk of a Linode from one Linode account to another. This is a great way to prepare a disk for another Linode customer and transfer it from one individual account to another individual account. Or if you have multiple Linode accounts, this guide provides instructions to consolidate all the disks in one account.
Note
If you are copying a disk of a Linode that hosts applications, then ensure that you complete the backup and migrate steps for the respective applications.
Preparing the Receiving Linode
You need to prepare the receiving Linode before initiating the transfer. First, create a Linode with a new disks to hold the files from the other Linode.
Creating a New Receiving Linode
Log in to the Cloud Manager with the username and password you created when signing up.
Click Create at the top of the page and select Linode.
Click X to not choose any Image in the Choose a Distribution section of the Distributions tab.
Choose the region where you would like the Linode to reside. If you’re not sure which to select, see our How to Choose a Data Center guide. You can also generate MTR reports for a deeper look at the route path between you and a data center in each specific region.
Select a Linode plan.
Give the Linode a label. This is a name to help you easily identify it within the Cloud Manager’s Dashboard. If desired, assign a tag to the Linode in the Add Tags field.
Create a root password for your Linode in the Root Password field. This password must be provided when you log in to the Linode through SSH. It must be at least 6 characters long and contain characters from two of the following categories:
lowercase and uppercase case letters
numbers
punctuation characters
Click Create. The system directs you to the Linodes page that reports the status of the Linode as it boots up.
Creating New Disks
To hold the files transferred from the other Linode, create two new disks labeled copy and swap:
Select the Linode that is receiving the disk. The Linode’s dashboard appears.
Go to the Disks/Configs tab and click Add a Disk in the Disks section. The Add Disk window appears.
Type a descriptive name such as copy for the disk in the Label field.
Select ext4 in the Filesystem dropdown field.
Set the size of the disk in the Size field. The size of the disk must be large enough to hold the contents of the disk that you want to copy.
Click Add to create the disk.
Repeat the steps to create a disk labeled swap and select swap in the Filesystem dropdown field.
Ensure that the size of the swap disk is the same as that of the swap disk of the disk that you want to copy.
The system creates disks to hold the files from the disk of other account.
Booting into Rescue Mode
Start the receiving Linode in rescue mode:
Select the Linode that is receiving the disk. The Linode’s dashboard appears.
Click the Rescue tab.
Set the /dev/sda field to copy and /dev/sdb to swap.
Click Reboot into Rescue Mode.
Access the Linode in Rescue Mode
After the Linode has booted, connect to the Linode through LISH.
Select the Linode that is receiving the disk. The Linode’s dashboard appears.
Click Launch Console . A new window appears that displays the Lish console, a Welcome to Finnix! message, and a root prompt.
Set the root password for the Finnix rescue environment by entering the following command:
passwd
Note
This root password is separate from the root password of the disk that you normally boot from. Setting the root password for Finnix does not affect the root account of the distribution.
Type the new password for the root user.
Start the SSH server:
service ssh start
You can now connect to the server as root with the SSH client on the local computer.
The Linode is now ready to receive the files from the other Linode account.
Copying the Disk
To start copying the files on the disk from one account to another, initiate the file transfer:
Connect to the source Linode through an SSH client.
Type the following command to start copying the disk, replace 192.0.2.0 with the IP address of the receiving Linode:
The following output appears. Enter yes to continue connecting:
The authenticity of host '192.0.2.0 (192.0.2.0)' can't be established.
RSA key fingerprint is 20:f4:de:4d:5c:6e:a9:c7:e6:1f:8a:ad:60:62:96:3f.
Are you sure you want to continue connecting (yes/no)?
The system prompts you for the root password. Enter the password you created in the last section when you started the SSH server:
[email protected]'s password:
The file transfer starts, as shown below:
2048000+0 records in
2048000+0 records out
1048576000 bytes (1.0 GB) copied, 391.504 seconds, 2.7 MB/s
2048000+0 records in
2048000+0 records out
1048576000 bytes (1.0 GB) copied, 387.843 seconds, 2.7 MB/s
Wait for the transfer to complete. Note that this process can take a while, depending on the size of your disk.
Verifying the Disk
After the file transfer has completed, you should verify the disk by mounting it on the receiving Linode. Ensure that the Network Helper is on for the receiving Linode or the Static IP is configured to enable networking with the new IP addresses.
Connect to the receiving Linode through SSH as root.
To check that the disks are transferred successfully make a new directory for the disk by typing the following command:
mkdir linode
Mount the disk by typing the following command:
mount /dev/sda linode
View the directories in the disk by typing the following command:
ls linode/
The output is similar to:
bin dev home lost+found mnt proc sbin srv tmp var
boot etc lib media opt root selinux sys usr
Note
If the system displays any disk errors, then perform the Copying the Disk steps again.
Now the Linode is ready to boot from the disk.
Booting from the Disk
Boot the receiving Linode from the disk. First, create a configuration profile on the receiving Linode, and then boot the receiving Linode with the disk that you just transferred.
Creating the Configuration Profile
To boot the receiving Linode from the transferred disk, create a new configuration profile:
Click the Linodes tab.
Select the Linode that received the disk. The Linode’s dashboard appears.
Select Disks/Configs tab and in the Configuration section click Add a Configuration. The Add a Linode Configuration window appears.
Enter a name for the configuration profile in the Label field, such as Received disk.
In the Block Device Assignment section, set /dev/sda to copy and /dev/sdb to swap disk.
Click Submit.
You have successfully created the configuration profile.
Booting the Receiving Linode
Now to start the receiving Linode from the transferred disk, select the configuration profile that you created:
From the Linode’s dashboard, select the Received disk configuration profile that you created.
Click the more options ellipsis and select Boot This Config to restart the Linode from the transferred disk.
The Linode boots using the disk you transferred.
This guide is published under a CC BY-ND 4.0 license.
Use promo code DOCS10 for $10 credit on a new account.
The Linode Backups service can create automatic and manual snapshots of your Linode. A completed backup can be directly restored to the origin Linode or to a new Linode in the same data center. These workflows make it easy to revert to a working configuration if you run into any unexpected issues with your software.
Linode’s backups are stored in a way that is only directly readable by the Linode Backups service. A common question for the service is how you can download the content from your Linode Backups to another storage location, like your home computer. This can be accomplished in two phases:
Restore a backup to a new Linode in the same data center.
Download either specific files or the entire disk image from that Linode, as needed.
Before You Begin
Account Permissions and Billing
Several of the steps in this guide involve adding services to or removing services from a Linode account. Visit our guide on Users and Permissions for more information about restricted Linode users.
Note that the cost of adding Backups service and adding a Linode to your account is billed, prorated per hour. If the backups service is only enabled for a few hours, you will only be charged for a few hours of the service. See the Backups pricing details for more information. Likewise, when you create a Linode, you will be billed per hour that the Linode exists, whether it is powered on or not.
The steps in this guide have been designed to minimize the potential costs associated with this process. Additionally, keep the following in mind:
Removing a Linode from your account also cancels the associated Backup service for that Linode.
A Linode’s backups are deleted when a Linode is deleted.
If you choose to leave the Backups service enabled, or if you do not remove the additional Linode from your account, you will be automatically billed. If you only power the Linode off, you will still be billed for it.
Enable Backups and Take a Snapshot
These steps are the minimum required for the scope of this guide. Visit our Backups guide for information about how to implement regular backups of your Linode.
Go to your Linode’s dashboard, click Backups, click Enable backups for this Linode » and confirm the additional cost per month.
This guide focuses on saving a snapshot or specific backup. Click Take a New Snapshot Now.
The snapshot appears in the Backup History at the bottom of the page.
Restore from a Backup
This section shows how to restore a backup to a new Linode, or to an existing Linode.
Restoring a backup will create a new configuration profile and a new set of disks on your Linode. The restore process does not restore single files or directories automatically. Restoring particular files can be done by completing a normal restore, copying the files off of the new disks, and then removing the disks afterward.
Note
The size of the disk(s) created by the restore process will only be slightly larger than the total size of the files restored. This means that the disk(s) created will be ‘full’.
Some applications, like databases, need some amount of free unused space inside the disk in order to run. As a result, you may want to increase your disk(s) size after the restore process is completed.
To restore a backup to a different data center, first restore to a Linode in the same data center, creating a new one if necessary. Once the restore is complete, use the Clone tab to copy the disk(s) to a Linode in a different data center.
Restore to a New Linode
You can restore a backup to any Linode located in the same data center, even if the target does not have the Backup Service enabled. This section covers how to restore a backup to a new Linode that does not have any disks deployed to it. If you wish to restore your backup to an existing Linode, see the next section.
From the Dashboard of the Linode whose backups you intend to restore, click on the Backups tab. Select the Restore to… link beneath the backup version that you want to restore.
Under the Select column, click the Restore to this Linode link next to your new Linode:
The backup disks and configuration profiles will be restored to the Linode you selected. Watch the Host Job Queue to monitor the progress. Restoring from a backup can take several minutes depending on the size of your Linode and the amount of data you have stored on it.
Restore to an Existing Linode
To restore a backup to an existing Linode, you will need to make sure that you have enough storage space that is not currently assigned to disk images.
Note
If you are attempting to restore a disk to the same Linode the backup was created from, the restoration process will not delete the original disk for you. Manually delete the original disk to make room for the backup.
Start by confirming the size of the backup that you wish to restore. From the Backups tab in your Linode’s Dashboard, click the Restore to… link beneath your desired backup version.
Check the Total size required field to confirm the size of your backup.
As an example, if the total size of the backup comes to 3107MB, this means you would need at least that much free space to restore the backup to your Linode.
Next, you’ll confirm the total space assigned to disk images on your Linode, via the Storage indicator on your Linode’s Dashboard.
If the amount of space available is greater than the size of the backup, you can proceed with restoring. If the amount of unallocated space is less than the size of the backup, you can resize your existing disks to make room for it.
Note
In some cases, you will not be able to shrink your disks enough to fit the restored backup. As an alternative, you can change your Linode’s plan to a higher tier that offers more disk space.
Once the disk resize has completed, check the storage indicator on your Linode’s Dashboard to confirm that you’ve freed up enough space for your backup.
From the Backups tab, click the Restore to this Linode link next to your Linode.
Your backup will begin restoring to your Linode, and you can monitor its progress from the Host Job Queue in your Linode’s Dashboard tab. Note that the time it takes to restore your backup will vary depending upon the restore size, and the number of files being restored.
Download Specific Files or Directories over SSH
If you just need specific files from your Linode, you can download those over SSH. In order to do so, you’ll first need to reboot your Linode under the new configuration profile that was created by the restore process. This new profile is assigned to the restored disks, and your backed up data will be accessible when you boot from them.
Downloading files over SSH can be done at a command-line interface, or with a graphical SFTP file browser.
Using SCP
To retrieve a specific directory or file via the command-line, you can use the secure copy (SCP) command from your computer. SCP is installed by default on most Mac and Linux systems, and you can install a tool like Cygwin to use it on Windows.
The syntax for using SCP to copy a file from your Linode into a directory on your computer is:
If /path/to/your/local/directory already exists on your computer, then the copied directory will be placed inside /path/to/your/local/directory (i.e. /path/to/your/local/directory/directory).
If /path/to/your/local/directory does not already exist, then the copied directory will be created with that name.
For example:
Download an NGINX configuration file to your home folder:
If you intend to repeat this process regularly, consider using rsync to create additional local copies of your data. rsync is capable of performing incremental file copies, which means you do not have to fully transfer each file every time you download your data.
Using FileZilla
As an alternative to the command-line, you can download and install an SFTP client. These applications provide a graphical user interface for your Linode’s filesystem.
FileZilla is a popular free example. Windows and OS X users can download FileZilla here. To install FileZilla on Linux:
After you’ve installed FileZilla on your computer:
Open FileZilla from your Windows start menu, OS X Launchpad, or the launcher provided by your Linux distribution of choice.
Enter your Linode’s IP address or domain name in the Host field. Enter the account username you wish to connect as in the Username field. Please note that this must be a user account on your Linode; if in doubt, enter root to log in as the root user. Enter the account’s password in the Password field, and enter “22” in the Port field. Click Quickconnect to initiate the file transfer session.
If this is the first time you’ve connected to your Linode with an SSH or SFTP program, you’ll receive a warning that the host key is unknown. Place a check mark in the box next to Always trust this host, add this key to the cache. Checking this box prevents further warnings unless the key presented to FileZilla changes; this should only happen if you reinstall the remote server’s operating system.
Click the OK button to proceed. You’ll be presented with a split view, with your local filesystem on the left and your Linode’s filesystem on the right. You may transfer files by dragging and dropping them between each side.
For more information on FileZilla, review our full guide on using the application.
Using mysqldump to Back Up a Database
Special care is needed when downloading data from a database. Before it can be downloaded, the data in a database needs to first be dumped to a file. This file can then be transferred just as any other normal file type.
Here’s a breakdown of the mysqldump command options used above:
--single-transaction: Issue a BEGIN SQL statement before dumping data from the server.
--quick: Enforce dumping tables row by row. This provides added safety for systems with little RAM and/or large databases where storing tables in memory could become problematic.
--lock-tables=false: Do not lock tables for the backup session.
For more information on MySQL database backups, including how to restore the data in a dump file to a MySQL installation, review our guide on the subject. An alternative to using mysqldump is to create physical backups. It’s also possible to backup PostgreSQL databases.
Download a Disk over SSH
Downloading your disk will copy a .img file to your computer that encapsulates all of the data that is on your Linode’s disk.
Prepare the Receiving Computer
Verify that the receiving computer has SSH installed. (Most Linux/Unix-like systems have it installed by default.) If you’re running Windows locally, you may wish to set up the Cygwin compatibility layer to provide a reasonably complete Unix-like environment. Instructions on setting up Cygwin are located here.
Start Your Linode in Rescue Mode
Before you initiate the transfer, start the source Linode in Rescue Mode and start SSH by following these guides:
Start your Linode in Rescue Mode.
Connecting to a Linode Running in Rescue Mode via LISH.
Start the SSH server on your Linode.
Copy the Disk
Now that the Linode is running in Rescue Mode, you can transfer the disk from the Linode to the receiving machine over SSH:
Enter the following command on the receiving machine. Replace 123.45.67.89 with the Linode’s IP address and /home/archive/linode.img with the path where you want to store the disk:
The device /dev/sda is used for Linodes running on top of KVM. If your Linode is still using XEN, then throughout this guide you must use /dev/xvda instead.
The receiving machine will connect to the Linode. Type yes and press Enter to continue connecting:
The authenticity of host '123.45.67.89 (123.45.67.89)' can't be established.
RSA key fingerprint is 39:6b:eb:05:f1:28:95:f0:da:63:17:9e:6b:6b:11:4a.
Are you sure you want to continue connecting (yes/no)? yes
Enter the root password for the Linode:
Warning: Permanently added '123.45.67.89' (RSA) to the list of known hosts.
[email protected]'s password:
The transfer starts, and you’ll see output similar to the following:
4096000+0 records in
4096000+0 records out
2097152000 bytes (2.1 GB) copied, 371.632 seconds, 5.6 MB/s
4096000+0 records in
4096000+0 records out
2097152000 bytes (2.1 GB) copied, 364.002 s, 5.8 MB/s
Note
Copying your disk can take a while. Please be patient. If you have a slow internet connection, add the -C option to the SSH command; this enables gzip compression for data transfer. If you receive a Write failed: Broken pipe error, repeat this process.
Verify the Disk
Once the copy has completed, you can verify it by mounting the image on the receiving machine.
Log in to the receiving machine as root by entering the following command and entering the root user’s password:
su
Make a directory on the receiving machine by entering the following command:
mkdir linode
Mount the disk by entering the following command, replacing linode.img with the name of the disk:
mount -o loop linode.img linode
View the directories stored on the disk by entering the following command:
ls linode/
You should see the directories on the disks, similar to the ones shown below, indicating that everything has transferred:
bin dev home lost+found mnt proc sbin srv tmp var
boot etc lib media opt root selinux sys usr
Clean Up after Your Download
After you’ve finished downloading your files or disks, you can optionally delete the restored disks. If you created a new Linode to perform the restore, consider deleting the Linode. As a reminder, billing for that Linode will continue automatically if you do not remove it. If you only power the Linode off, you will still be billed for it.
Join our Community
Find answers, ask questions, and help others.
This guide is published under a CC BY-ND 4.0 license.