You've already forked www.colben.cn
update
This commit is contained in:
@@ -7,12 +7,12 @@ tags: ["centos", "系统", "迁移"]
|
||||
categories: ["os"]
|
||||
---
|
||||
|
||||
# 环境
|
||||
## 环境
|
||||
- 两台服务器(A,B)
|
||||
- A 已安装好 CentOS7,且已**关闭 selinux**
|
||||
- B 裸机,待安装操作系统
|
||||
|
||||
# 打包根分区
|
||||
## 打包根分区
|
||||
- 从 B 上拆下系统硬盘,接在 A 上,启动 A
|
||||
- 清空日志(推荐)
|
||||
```bash
|
||||
@@ -33,7 +33,7 @@ categories: ["os"]
|
||||
tar zcpf /centos7.tgz --exclude=/centos7.tgz --one-file-system / /boot/efi
|
||||
```
|
||||
|
||||
# 硬盘分区
|
||||
## 硬盘分区
|
||||
- 假设 /dev/sdb 是 B 的系统硬盘
|
||||
- MBR 启动时,分区表是 dos,只分一个根分区即可
|
||||
- EFI 启动时,分区表是 gpt,需要分一个 512MB 的 **efi 分区**和一个根分区
|
||||
@@ -43,7 +43,7 @@ categories: ["os"]
|
||||
# t 指定分区类型 1 (即 efi system)
|
||||
```
|
||||
|
||||
# 格式化
|
||||
## 格式化
|
||||
- MBR 启动
|
||||
```bash
|
||||
mkfs.xfs /dev/sdb1
|
||||
@@ -54,7 +54,7 @@ categories: ["os"]
|
||||
mkfs.xfs /dev/sdb2
|
||||
```
|
||||
|
||||
# 挂载硬盘
|
||||
## 挂载硬盘
|
||||
- MBR 启动
|
||||
```bash
|
||||
mount /dev/sdb1 /mnt/
|
||||
@@ -66,7 +66,7 @@ categories: ["os"]
|
||||
mount /dev/sdb1 /mnt/boot/efi/
|
||||
```
|
||||
|
||||
# 部署操作系统
|
||||
## 部署操作系统
|
||||
- 解压之前打包的 /centos7.tgz
|
||||
```bash
|
||||
tar zxpf /centos7.tgz -C /mnt/
|
||||
@@ -90,7 +90,7 @@ categories: ["os"]
|
||||
rm -rf /etc/ssh/ssh_host_*
|
||||
```
|
||||
|
||||
# 部署 grub
|
||||
## 部署 grub
|
||||
- MBR 启动
|
||||
```bash
|
||||
mount --bind /dev/ /mnt/dev/
|
||||
@@ -113,7 +113,7 @@ categories: ["os"]
|
||||
exit
|
||||
```
|
||||
|
||||
# 启动操作系统
|
||||
## 启动操作系统
|
||||
- 卸载 B 的系统硬盘
|
||||
```bash
|
||||
umount -R /mnt
|
||||
@@ -121,6 +121,6 @@ categories: ["os"]
|
||||
- 关闭 A,拆下刚部署好操作系统的硬盘,接回 B 中
|
||||
- 启动 B,刚部署的 CentOS7 正常启动
|
||||
|
||||
# 参考
|
||||
## 参考
|
||||
- [https://wiki.centos.org/zh/HowTos/ManualInstall?highlight=%28grub2-install%29](https://wiki.centos.org/zh/HowTos/ManualInstall?highlight=%28grub2-install%29)
|
||||
|
||||
|
Reference in New Issue
Block a user