前言
从一个月前安装飞牛,遇到很多问题或者需求,都在论坛中各种大佬的帖子中找到了解决办法。今天记录一下硬盘无损替代并进行扩容的方法,希望可以帮助到其他有需要的兄弟们。
- 操作有风险!!!!!!!
- 尽量做好数据备份,并且原硬盘不要格式化,测试无误并稳定运行一段时间之后再处理原硬盘。
需求
飞牛已经使用的一块128GB固态硬盘,想要替换为一块1t固态硬盘,需要内容无损迁移,储存空间仍为原来的储存空间5不变
准备工作
- 飞牛主机
- 装有pe系统的U盘
- 硬盘盒+1t固态硬盘
操作步骤
1. 进入PE系统进行硬盘扇区克隆
- 开机并更改启动项,进入PE系统
- 打开diskgenius,进行硬盘克隆,将128GB硬盘按扇区克隆到1t硬盘中(最完整的克隆)
2. 替换原硬盘
3. 进入飞牛系统测试
进入系统后,原储存空间不变,内容正常访问;此时储存空间容量仍为128GB,但对应硬盘大小为1t
4. 通过SSH连接进行扩容
此处参考了【新提醒】我也来分享一下飞牛OS更换数据盘,无损数据迁移以及扩容全过程 - 攻略分享 飞牛私有云论坛 fnOS一帖中的扩容操作。
- 查看当前挂载的全部硬盘,并找到对应储存空间5的硬盘、Linux RAID阵列以及lvm逻辑卷
- 可以通过容量大小进行对应,硬盘/dev/sdb 为1t;Linux RAID阵列以及lvm逻辑卷此时均为128GB
- sudo -i 进入root模式
- fdisk -u -l 查看
Disk /dev/sdb: 931.51 GiB, 10002048016 bytes, 19535168 sectors
Disk model: Great Wall GW100
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/md127: 119.18 GiB, 1279667888 bytes, 2493824 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/trim_c2101dee_5cc_b0d_8f0a0c7eaf8f-0: 119.18 GiB, 1279640207 bytes, 2499728 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
- 扩容磁盘分区
- fdisk /dev/sdb 回车
- d 回车
- n 回车,一直回车,yes/no选n 回车
- t 回车
- 42 回车
- w 回车
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition number (1-128, default 1):
First sector (34-1953525134, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1953525134, default 1953523711):
Created a new partition 1 of type 'Linux filesystem' and of size 931.5 GiB.
Partition #1 contains a linux_raid_member signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): t
Selected partition 1
Partition type or alias (type L to list all): 42
Changed type of partition 'Linux filesystem' to 'Linux RAID'.
Command (m for help): w
The partition table has been altered.
Syncing disks.