侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 中国象棋ai
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

通过Linux系统将Windows系统迁移到到新的磁盘上

Windows  /  管理员 发布于 7年前   162

1. 概述
这篇文章将告诉你如何再 linux 系统下,将 安装好的windows版本 复制到新的磁盘上(新的磁盘大于等于window镜像大小)


2. 使用到的工具
livecd 工具,可以是CD 也可以是USB启动的 ,需要有的工具 dd, fdisk, and ntfsresize.
此例子中,使用如下假设:
/dev/sdc (新硬盘)
/dev/sdb (老硬盘,安装好的window版本数据在 /dev/sdb1 分区中)
= 格式化新盘(/dev/sdc) =
使用root 用户,进行如下分区操作

复制代码代码如下:
[root@centos6 ~]# fdisk /dev/sdc

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-2088, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-2088, default 2088):
Using default value 2088

Command (m for help): p

Disk /dev/sdc: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa1c3a1c3

Device Boot Start End Blocks Id System
/dev/sdc1 1 2088 16771828+ 83 Linux

在完成之前,我们必须设置启动标志和分区系统ID,分区系统ID必须是WINDOWS的,ID值为 7.

复制代码代码如下:
Command (m for help): A
Partition number (1-4): 1

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)

Command (m for help): p

Disk /dev/sdc: 17.2 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa1c3a1c3

Device Boot Start End Blocks Id System
/dev/sdc1 * 1 2088 16771828+ 7 HPFS/NTFS

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

= 复制MBR =
为了让新盘能够引导, 我们必须从Master Boot Record (MBR) 复制引导代码到新的磁盘上
MBR 在磁盘的第一个扇区,由3部分组成:

复制代码代码如下:
Boot Code (446 bytes)
Partition Table (64 bytes)
Boot Code Signature = 55aa (2 bytes)

我们只需要复制引导代码,起始的 446 bytes. 使用dd工具来复制:

复制代码代码如下:
# dd if=/dev/sdb of=/dev/sdc bs=446 count=1
1+0 records in
1+0 records out
446 bytes transferred in 0.026312 seconds (16950 bytes/sec)

= 复制分区 =
下一步任务就是将文件系统从一个盘复制到另一个盘上.在这里我们使用 ntfsclone 工具来复制 NTFS 文件系统

复制代码代码如下:
[root@centos6 ~]# ntfsclone --overwrite /dev/sdc1 /dev/sdb1</p><p> ntfsclone v2013.1.13 (libntfs-3g)
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 10725732352 bytes (10726 MB)
Current device size: 10725732864 bytes (10726 MB)
Scanning volume ...
100.00 percent completed
Accounting clusters ...
Space in use : 7565 MB (70.5%)
Cloning NTFS ...
100.00 percent completed
Syncing ...

如果在源盘上有坏的扇区,则需要添加 --rescue 选项

复制代码代码如下:
# ntfsclone --rescue --overwrite /dev/sdc1 /dev/sdb1

注意: 源盘 是 最后一个参数(/dev/sdb1)


3. 改变分区大小
在新盘比源盘大的情况下,我们需要改变分区大小来使用所有空间,这里我们使用 ntfsresize 命令

复制代码代码如下:
[root@centos6 ~]# ntfsresize /dev/sdc1</p><p> ntfsresize v2013.1.13 (libntfs-3g)
Device name : /dev/sdc1
NTFS volume version: 3.1
Cluster size : 4096 bytes
Current volume size: 10725732864 bytes (10726 MB)
Current device size: 17174352384 bytes (17175 MB)
New volume size : 17174348288 bytes (17175 MB)
Checking filesystem consistency ...
100.00 percent completed
Accounting clusters ...
Space in use : 7565 MB (70.5%)
Collecting resizing constraints ...
WARNING: Every sanity check passed and only the dangerous operations left.
Make sure that important data has been backed up! Power outage or computer
crash may result major data loss!
Are you sure you want to proceed (y/[n])? y
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sdc1'.


4. 使用新盘重新启动系统
重新启动后,windows 会自动检查文件系统如下(因为分区大小有所变化),检查完成后自动重起就能进入windows系统了


5. 总结
当然这种方式的拷贝是在同一台服务器上操作的(驱动无变化),如果将一个干净的windows裸系统通过这种方式安装到不同型号的服务器上时, 就会出现驱动问题,如何解决,请看下回分解!


  • 上一条:
    在Linux上使用Wine安装轻聊版的QQ的步骤讲解
    下一条:
    windows 服务器注意windows的temp临时目录(temp文件过大问题)
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • Windows 10的告别:2025年10月14日,一段时代的终结(0个评论)
    • windows 11激活_Win11 KMS激活流程步骤(1个评论)
    • 安装Windows 11系统的注意了,看看你的cpu是否在微软兼容列表排除中(1个评论)
    • 微软将于2022年9月20日推送Windows11 22H2新版本,推测2024发布windows 12(0个评论)
    • windows11系统中可以关闭禁止的服务及介绍(1个评论)
    • 近期文章
    • 在go中实现一个常用的先进先出的缓存淘汰算法示例代码(0个评论)
    • 在go+gin中使用"github.com/skip2/go-qrcode"实现url转二维码功能(0个评论)
    • 在go语言中使用api.geonames.org接口实现根据国际邮政编码获取地址信息功能(1个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf分页文件功能(0个评论)
    • gmail发邮件报错:534 5.7.9 Application-specific password required...解决方案(0个评论)
    • 欧盟关于强迫劳动的规定的官方举报渠道及官方举报网站(0个评论)
    • 在go语言中使用github.com/signintech/gopdf实现生成pdf文件功能(0个评论)
    • Laravel从Accel获得5700万美元A轮融资(0个评论)
    • 在go + gin中gorm实现指定搜索/区间搜索分页列表功能接口实例(0个评论)
    • 在go语言中实现IP/CIDR的ip和netmask互转及IP段形式互转及ip是否存在IP/CIDR(0个评论)
    • 近期评论
    • 122 在

      学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..
    • 123 在

      Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..
    • 原梓番博客 在

      在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..
    • 博主 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..
    • 1111 在

      佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
    • 2018-01
    • 2018-06
    • 2020-06
    • 2021-06
    • 2021-07
    • 2022-01
    • 2022-04
    • 2022-08
    • 2023-08
    • 2023-10
    • 2024-04
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客