LoginSignup
12
15

More than 5 years have passed since last update.

さくらVPSからConoHa VPSへディスク丸ごと移行してみた

Last updated at Posted at 2017-02-11

背景

ConoHa VPS(以下コノハ)がイケてるという話を聞いて試してみたいと思っていた。現在、さくらVPSで趣味のArch Linuxサーバを立てていて、できればこれを丸ごと移行したい。

しかしArchを入れてrsyncでコピーするのも時間かかるだろうなあ~と思っていたのだが、コノハにはSSD 20GBのプランがある。今使っているさくらVPSもSSD 20GB。もしかしてssh越しでディスクデバイス丸ごとコピーすればいけるんじゃね?と思って試してみたら、無事にできた。

要はコノハVPS(CentOS 7.3)の中から下記コマンドを実行した:

ssh さくら cat /dev/vda > /dev/vda

はじめてやったけどできるもんなんですね。

事前確認

lsblk

どちらもデバイス名はvdaで21474836480バイト(20 GiB)。

さくら

# lsblk -b
NAME   MAJ:MIN RM        SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  1073741312  0 rom  
vda    254:0    0 21474836480  0 disk 
├─vda1 254:1    0   104857600  0 part /boot
├─vda2 254:2    0  2147483648  0 part [SWAP]
├─vda3 254:3    0 19221429760  0 part /
└─vda4 254:4    0     1031168  0 part

コノハ

# lsblk -b
NAME   MAJ:MIN RM        SIZE RO TYPE MOUNTPOINT
sr0     11:0    1  1073741312  0 rom  
sr1     11:1    1      493568  0 rom  
vda    253:0    0 21474836480  0 disk 
├─vda1 253:1    0     2097152  0 part 
└─vda2 253:2    0 21470642176  0 part /

/proc/cpuinfo

なんとなくcpuinfoも見てみた。さくらの方が周波数は上(それゆえbogomipsも)。

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 62
model name      : Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz
stepping        : 4
microcode       : 0x1
cpu MHz         : 2599.998
cache size      : 20480 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm vnmi ept fsgsbase tsc_adjust smep erms xsaveopt
bugs            :
bogomips        : 5202.66
clflush size    : 64
cache_alignment : 64
address sizes   : 40 bits physical, 48 bits virtual
power management:

ConoHa

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 63
model name      : Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz
stepping        : 2
microcode       : 0x1
cpu MHz         : 2294.686
cache size      : 4096 KB
physical id     : 0
siblings        : 1
core id         : 0
cpu cores       : 1
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt
bogomips        : 4589.37
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:

あとで気づいたのだが、BIOSかUEFIも確認しておけばよかった。VPSだからきっとBIOSだろうけど。UEFIパーティションが無いことからBIOSと判定していいんだろうか?

実行手順

コノハでサーバを立てる

コノハでCentOS 7.3のサーバーを追加して、まず普通にログイン(ユーザー名はroot。鍵は自分で設定したもの)。さくらにsshできるように設定。

コマンド実行

コノハの中から

# time ssh さくら cat /dev/vda > /dev/vda

dstatで転送速度を見てみたところ、12 MiB/s(約100 Mbps)。20 GiBなら28分で終わる計算。実際29分で終わった。

real    29m43.565s
user    1m53.760s
sys     2m41.834s

ここでリブート。

ネットワーク設定

固定IPで設定してあったので、コノハのコンソールからArchにログインしてネットワークの設定(/etc/netctl/eth0)を変更。

以上で普通に使えるようになった。
2017−04−03現在まで、何もトラブル無く使えている。

12
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
15