## Backup the current vps 备份当前vps | |
1. Clean Arch system 清理系统 | |
pacman -Scc | |
2. Create an excluded file to exclude certain dirs 建立一个需要排除的目录的文件,这些文件不必要备份,新系统会自动生成 | |
cat /root/backup/exclude.txt | |
/tmp/* | |
/root/backup/* | |
/proc | |
/dev | |
/sys | |
3. Backup with tar 用tar备份当前系统 | |
tar --exclude-from=/root/backup/exclude.txt -czpvf /root/backup/archlinux-backup.tar.gz / | |
## Restore to new vps 还原到新的服务器 | |
1. Boot to the new VPS from archlinux CDROM from VPS provider's Console 通过vps的管理界面光盘启动 | |
2. Partition the disk to the same structure with the source server which is the backup system 给新系统分区,保持与就系统同样的分区结构 | |
cfdisk /dev/vda | |
3. format the root and mount to /mnt, also create a swap partition. 格式化根目录分区,并mount, 同时创建swap分区 | |
mkfs.ext4 /dev/vda1 | |
mount /vda1 /mnt | |
mkswap /dev/vda2 | |
swapon /dev/vda2 | |
4. scp archlinux-backup.tar.gz from old vps to /mnt 将先前备份的arch拷贝到 /mnt | |
scp username@server:/root/backup/archlinux-backup.tar.gz /mnt/ | |
5 extract the backup file 解压到新服务器的根目录,也就是/mnt目录 | |
cd /mnt | |
tar -xvf archlinux-backup.tar.gz | |
6 create missed dirs 创建之前忽略掉的文件夹 | |
cd /mnt | |
mkdir proc sys dev | |
7 generate the new fstab 生成新的fstab | |
genfstab -U -p /mnt > /mnt/etc/fstab | |
8 chroot to the new root chroot到新的系统 | |
arch-chroot /mnt /bin/bash | |
9 reinstall grub and grub.cfg 安装grub到新系统并生成配置文件 | |
grub-install --target=i386-pc --recheck /dev/vda | |
grub-mkconfig -o /boot/grub/grub.cfg | |
## Remarks | |
1 Finished, reboot, note the new machine has a new ip address, do not forget to apply the new ip to the files that has specified an ip address. 至此完成,新系统会有新的ip地址,如果之前的系统某些文件特别定义了ip地址,需要做相应的修改。 | |
2 If you have custome build, you have to makepkg again on the new system, because the CPU is different. 如果之前有自定义安装的包,需要再新系统里面重新makepkg |
![]() |
1
Yien 2014-12-13 02:27:53 +08:00 via iPhone
感谢分享
|
![]() |
2
vimutt 2014-12-13 03:00:27 +08:00
lz有ikev2的配置教程吗 我用的三特系统 找了几个帖子 没有配置成功
|
![]() |
3
laputaprince 2014-12-13 03:47:42 +08:00
Archlinux 在服务器环境下真心大丈夫? lz多久升级一次?
|
4
bitwing 2014-12-13 03:52:18 +08:00
Arch 有 lts 版内核
|
![]() |
5
cattyhouse OP @vimutt 有啊,请看我之前的发帖啊,我的github上有完整的ike1和2的配置gist
|
![]() |
6
cattyhouse OP @laputaprince 它是rolling release,滚动更新没有版本概念,所以一只更新
|
![]() |
7
laputaprince 2014-12-13 09:08:59 +08:00
@cattyhouse 我桌面用的arch。服务器上跑arch我个人真没这个耐心。所以一直很好奇每天上去pacman -Syu的人是什么状态,haha。
不过话说回来,更新之前看下arch news,注意一些比较大的版本变化应该也不至于跑挂,就是麻烦些。 |
![]() |
8
vimutt 2014-12-13 09:28:05 +08:00
@cattyhouse 多谢 一会去看看 有不懂得还要请教
|
![]() |
9
cattyhouse OP @laputaprince 我的VPS上跑了个Arch,然后直接建了一个每4小时运行一次的cron,内容是:pacman -Syu --noconfirm
|