How to clone a drive in Linux

howtoclonedriveinlinux

 

Ever wonder how to clone a drive in Linux? it does sound like a complicated task, however, you'd be surprised at how easy it actually is under normal circumstances; say you just bought an SSD drive and want to replace that old and slow mechanical drive, or you just got an additional partition on your Cloud VPS and you want to clone your existing one, well, this guide should help in any of those situations.

What we need:

We first need a bootable ISO image of any Linux distro you prefer on a flash drive (or a simple bootable ISO from your Cloud VPS control panel). We also need the target hard drive to be as big or bigger than the source drive.

Once we have this checked we'll go ahead and boot from the bootable Linux distro (flash drive for physical or ISO for Cloud VPS) making sure the target drive is plugged in (or if virtual let's make sure the new drive has been attached) and we'll run the following to identify source and target partitions:

$ cat /proc/partitions

 

should look like this:

# cat /proc/partitions

major minor  #blocks  name
 
11        0    1048575 sr0
252        0   31457280 vda
252        1   31455104 vda1
252       16   52428800 vdb

 

You should see a list of all available drives; we need to identify the names of source and target drives, in this case the source drive is vda (30gb)  as shown on the image and target drive is vdb (50gb), you'd want to make sure you get these names right, if you mistakenly use a different name that actually exists you may end up trashing your data.

$ sudo dd bs=4M conv=sync,noerror status=progress if=/dev/vda of=/dev/vdb

 

The time it takes to complete the whole process depends on the size of the drive but it sure can take some time to complete, once it does you should be able to boot from the new drive just as you were able to from the source drive.

Now you know how to easily clone a drive in Linux.

Looking for a Cloud VPS or dedicated server to host your web or application? check out https://owned-networks.net

  • clone a drive, linux, clone
  • 0 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

ownCloud Auto Install Script on Debian 7

Here is an easy way to install ownCloud on Debian 7 with a script, but first, for those who...

NGINX – Allow access only to certain IPs

Nginx has a nice module that not many people know about, it basically enables us...

How to configure NTP client in CentOS

What's NTP? NTP stands for Network Time Protocol, and it is an Internet protocol used to...

Initial Server Setup on CentOS 6

Here are some recommendations to setup your VPS or server when you first get it, some of these...

How To Install nginx on CentOS

What is NGINX? Nginx (pronounced "engine-x") is an open source reverse proxy server for HTTP,...