虚拟机 安装 deepin 20.8 并制作 raid1 镜像

目标:通过vmware虚拟机安装deepin 20.8,其中diska装系统,diskb和diskc做raid1镜像。

我的vmware版本是VMware® Workstation 16 Pro 16.2.3 build-19376536,操作系统选项没有deepin,我选择debian 10.x 64位。

根据本人笔记本电脑情况,我赋予虚拟机4线程4G内存,diaka容量60GB,diskb和dickc分别40GB

启动安装,选择第1项5.15内核,选择中文
diska的磁盘分区
选择手动安装/选择sda
(1)选择sda可用空间,挂载点中选择/boot,默认分区大小为1536M
(2)选择sda可用空间,文件系统中选择交换分区,设置大小为4096M
(3)选择sda可用空间,挂载点选择/(根分区),设置大小为sda的剩余部分。
点击下一步,选择继续安装。持续安装。。。

tshug@tshug-PC:~/Desktop$ sudo fdisk -l
Disk /dev/sda: 60 GiB, 64424509440 bytes, 125829120 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xabf7c327

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 3147776 3145729 1.5G 83 Linux
/dev/sda2 3149824 11538432 8388609 4G 82 Linux swap / Solaris
/dev/sda3 11540480 125829118 114288639 54.5G 83 Linux

Disk /dev/sdb: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2a4ac06b

Disk /dev/sdc: 40 GiB, 42949672960 bytes, 83886080 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x423548af
tshug@tshug-PC:~/Desktop$

sdb,sdc 是两个40GB大小的磁盘,需要做raid1镜像
tshug@tshug-PC:~/Desktop$ sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-83886079, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-83886079, default 83886079):

Created a new partition 1 of type 'Linux' and of size 40 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
//////

tshug@tshug-PC:~/Desktop$ sudo fdisk /dev/sdc

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-83886079, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-83886079, default 83886079):

Created a new partition 1 of type 'Linux' and of size 40 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

tshug@tshug-PC:~/Desktop$ sudo fdisk /dev/sdc

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-83886079, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-83886079, default 83886079):

Created a new partition 1 of type 'Linux' and of size 40 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

创建阵列

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
命令解释:

--create:创建阵列
--verbose:输入详细信息
/dev/md0:创建后的阵列的设备名
level:要创建的 RAID 的级别,这里使用模式 1
raid-devices:指定 RAID 副本的磁盘数。在这里指定了 2 ,意思是平时有两个磁盘在工作。
如果以后添加了第三块硬盘,那么第三块硬盘将作为备用磁盘。当工作中的两块磁盘有一块坏了,第三块将立刻启动,并将完好的一块的内容复制到新的盘中。

查看阵列是否创建成功

由于上面命令创建后的阵列设备名为:/dev/md0,所以直接使用 fdisk -l 命令查看即可。

创建文件系统并挂载

  1. sudo mkfs.ext4 -F /dev/md0

挂载存储到 /data 目录

  1. mount /dev/md0 /data

保存阵列布局

完成以上步骤后,将阵列保存下来,在下次启动的时候自动加载,

因此需要将阵列信息保存到 /etc/mdadm/mdadm.conf 文件中。可以通过以下命令来自动扫描活动阵列并追加文件:

mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
更新初始RAM文件系统(initramfs)

update-initramfs -u
保存挂载信息,修改 /etc/fstab 文件

/dev/md0 /data ext4 defaults 0 0

启用ssh
sudo apt install openssh-server
sudo systemctl start ssh
sudo systemctl stop ssh
sudo systemctl enable ssh

everything is OK.

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容