3

I have a server, with a single hard disk (500GB Ubuntu OS 14.04), and I bought a new one having 1 SSD (250GB, which I thought I could use for the OS) and 2 normal SATA disk (2000GB, to use in RAID).

Now, I'd want to restore the content of the first server on the second. The ideal situation for the second is having the OS on the SSD and the data/applications on one SATA, so to use the RAID to backup. (right?)

Using clonezilla I can save an image of the first server and restore on one SATA of the second (SSD is too small), then, hopefully, activate RAID and see what happens, but in this way the SSD power is unused.

There is a software I don't know about, that can manage this situation? What is the best way to deal with this, excluding, obviously, reinstalling OS and then all the content and settings of the first server?

EDIT: Using @s1lv3r reply like the bible resulted in all working in the end, but I had also to deal with a couple of things:

  • The cloned ssd had the same uuid of the spinning disk so I had to change it with 'tune2fs -U random /dev/your_sd_id'

  • grub did not react well to the whole process so I had to launch a live version of linux and repair it with a tool named 'boot-repair'.

  • I have a nvidia card on the new server so, in order to make system start, I had to make it start with 'nomodeset' instead of 'quiet splash' (In grub menu choose your starting system option, press 'e' and change it) then manually install nvidia driver.

Truly, solving these things took a lot of time and tests, but these general indications could make the difference for someone trying to solve them.

Sasha Grievus
  • 223
  • 2
  • 11

4 Answers4

4

Important things first; you seem to have a misconception about RAID. RAID is no backup, what ever disk layout you end up choosing, you'll need to make external backups of your data if you care for it.

If you plan on using the SSD (or any non RAID disk for this matter), you'll have to be aware, that even if the SSD only contains the operating system and no data, a failure of this SSD will result in your server beeing completely down until you fix this. I'm not saying that you shouldn't do so, but you should be aware of this. If uptime is really important for you, you would be better off only using the spinning disks in a mirrored setup.

If you want to go on with your plan (single SSD for system, RAID1 spinning disks for data) I would suggest the following steps for a safe migration process:

  1. Clone the image of the 500G disk to one of the 2000GB disks.
  2. Mount the 2000GB disk from a Live-CD, clean the 500G partition on it (delete the data you won't need on the system disk) and defragment it.
  3. Use Clonezilla to rezize the 500G partition on the above mentioned 2000G disk to 250G (this is a critical step which may destroy the data if you are really unlucky, but while this is very unlikely, if this happens you'll still have the original 500G disk in place - so you don't have to worry).
  4. Clone the resulting 250G partition to the SSD.
  5. If everything worked out and the new system boots from the SSD you can create the RAID for the spinning disks and copy the files for the data partition from the original 500G disk to the newly setup RAID device.
s1lv3r
  • 1,155
  • 1
  • 14
  • 24
  • Uptime is not really a problem for the server use is for personal development, though it has to be online for several reasons. I though that having OS on SSD could resolve in a large improvement of performance and speed, while important data could be stored on the spinning disk that are more likely to have a failure. Truly data are still safe in git repository, too, but I have two 2TB hard disk so why not to take advantage of that ;) Defrag is really necessary on linux? What software would you use to do that? – Sasha Grievus Dec 14 '16 at 16:04
  • I was thinking about resizing the 500GB partition on the first server to 230GB in order to clone it all directly on the SSD, creating a partition /var on the spinning disk and copy there /var data (important data are stored almost all there), then, in some way, point to linux that its /var is on the new partition... Could this be a good idea, too? – Sasha Grievus Dec 14 '16 at 16:06
  • 1
    @SashaGrievus Yeah, if the data isn't that important you can resize in place and then clone. It's just that resizing partitions is always a potentially destructive process, so with tough luck you'll end up with no working server at all when you resize on the original server ... Exactly, you just need to set the [mountpoint](http://www.linfo.org/mount_point.html) of the RAID partition to `/var`. That is the way partitions work under linux anyway. – s1lv3r Dec 14 '16 at 16:21
  • 1
    @SashaGrievus e4defrag is the recommend onboard-tool for ext4 filesystems. Ext4 is generally made to work well without defrag in daily usage, but prior to shrinking the partition it's still recommened I think. – s1lv3r Dec 14 '16 at 16:33
  • Yes, sound wiser! I'm not sure about how to 'set the mountpoint', but I think I'll figure out. Thank you *very* much! – Sasha Grievus Dec 14 '16 at 16:40
  • 1
    @SashaGrievus That's pretty easy, it's all inside the link in my previous comment. `cat /etc/fstab` shows your systems current mounts, `mount /dev/yourhdd /mountpoint` mounts a partition manually (until reboot) from the command line. :-) – s1lv3r Dec 14 '16 at 16:58
3

You can try installing the same OS to the new server and using rsync to migrate all data.

rsync -avzAXS --numeric-ids --progress --exclude={lib/modules,etc/udev,lib/udev,boot,dev,proc,sys,run,etc/fstab,etc/inittab,tmp,var/tmp} --exclude={home/virtfs,backup} -e ssh . XX.XX.XX.XX:/

To ensure successful migration, you can try doing this either from rescue CD, or with putting your fs in readonly.

Tamerlan Abu
  • 116
  • 4
2

In case you have several partitions on 500 drive (/sda1 as /, /sda2 as home, /sda3 /var etc.) try run clonezilla to create and save drive using separate image file for each partition. Therefore, when you would try to restore, you could restore ubuntu OS root onto SSD and let say /home onto RAID.

Mr. Raspberry
  • 3,878
  • 12
  • 32
  • 1
    I have not, unfortunately, but this could be done after the clone on the second server? Let's say the only dir I want to store on the SATA disks is /var... I can copy /var data to SATA and point to the OS that /var is there? – Sasha Grievus Dec 14 '16 at 16:09
  • 2
    Correct, you can modify /etc/fstab modifing and/or asigning mounting points in order you want to https://help.ubuntu.com/community/Fstab – Mr. Raspberry Dec 14 '16 at 16:56
1

Warning! before you do anything! When you want to use clonezilla or any other tool what process the data from A disk to B disk. You should resize partitions of your A disk (500GB HDD) to maximal size of your B disk (250 GB SSD). Be aware of your partition table cos simple clonning will clone all your data (blocks) to blocks what do not exist on disc B (250GB SSD).

You should do complete defragmentation, resize the partitions to maximum size of you disc B (250GB , in disc A [500GB] an size of 250GB should be free and non-partitioned). After repartition it is recommend to make 2nd defragmentation to avoid data loos and problems.

gcboard
  • 1
  • 8