# How to clone drive and change boot priority after primary drive fail?



## ICPH (Nov 1, 2014)

Hi,

 

server has 2 drives, primary SSD with operating system and secondary HDD.

I want to clone SSD into HDD. So if SSD fail, i can somehow just switch boot priority and reset server to boot from HDD.

 

*STEP1* - What command/s i need to do to do this clone? Also link to tutorial would help

 

*i found one tutorial on how to clone hdd which says*: boot live linux ISO via IPMI/DRAC and check which drive is which:

cat /proc/partitions

if source drive is sda and destination is sdb, then do:

dd if=/dev/sda of=/dev/sdb bs=1024

(the destination drive should be smae? or bigger than source drive..

 

i did not tested this. is there anyone who tested or know good tutorial?

 

---

Then *STEP 2* - how to change boot priority if primary drive fails badly? I assume filesystem will be in read-only state or totally non responding, so reset server and via IPMI/DRAC do something, what? Hitting "Del" key or such to enter bios and select boot drive?


----------



## ultrabizweb (Nov 1, 2014)

I don't know if this will help you or not but I have used clonezilla distro to make a bare metal copy of my ProxmoxVE server via IPMI and seemed to work pretty well copied the image via ssh to a backupsy vps I had, however I had to take the server down for a bit to do the image back up. I think it was worth the down time to get a complete bare metal backup and it did not cost me much but a little bit of down time.

You should be able to copy to the HDD as well and it will be much faster than ssh like mine. I believe the official site is clonezilla.org I do not know if this is exactly what you want to do but copying live file systems can be tricky and I really would not recommend it. The other option if you need live snapshots which is what I do on my system is I have 2 drives both HDD could not afford primary SSD at the time. ProxmoxVE is installed on first drive and I do nightly snapshots to the second drive which is a glusterfs mount which replicates the snapshot to another kvm vps server. That way my virtual machines are backed up each night. Then as I stated above I do bare metal via clonezilla and IPMI so I can more easily recover my ProxmoxVE installation if I ever have to. 

I hope this might have helped you in some way.


----------



## devonblzx (Nov 1, 2014)

Yes, you can run dd to initially clone your drive but it would be pretty resource intensive running it multiple times if you're trying to keep the files synced.  Once you initially clone the drive, you should probably use something like rsync on the mounts, not the device itself.

As for dd, I wouldn't recommend cloning the entire drive.  I would recommend cloning partitions.  So make a partition on the second drive and do something like:

dd if=/dev/sda*1* of=/dev/sdb*1* bs=1M

I don't recommend using a block size as small as 1024, that would unnecessarily slow down this process.

You will also need to copy grub to that hard drive so it contains a boot loader.


----------

