虛擬機(jī) 安裝 deepin 20.8 并制作 raid1 鏡像

目標(biāo):通過vmware虛擬機(jī)安裝deepin 20.8,其中diska裝系統(tǒng),diskb和diskc做raid1鏡像。

我的vmware版本是VMware? Workstation 16 Pro 16.2.3 build-19376536,操作系統(tǒng)選項(xiàng)沒有deepin,我選擇debian 10.x 64位。

根據(jù)本人筆記本電腦情況,我賦予虛擬機(jī)4線程4G內(nèi)存,diaka容量60GB,diskb和dickc分別40GB

啟動(dòng)安裝,選擇第1項(xiàng)5.15內(nèi)核,選擇中文
diska的磁盤分區(qū)
選擇手動(dòng)安裝/選擇sda
(1)選擇sda可用空間,掛載點(diǎn)中選擇/boot,默認(rèn)分區(qū)大小為1536M
(2)選擇sda可用空間,文件系統(tǒng)中選擇交換分區(qū),設(shè)置大小為4096M
(3)選擇sda可用空間,掛載點(diǎn)選擇/(根分區(qū)),設(shè)置大小為sda的剩余部分。
點(diǎn)擊下一步,選擇繼續(xù)安裝。持續(xù)安裝。。。

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 是兩個(gè)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.

創(chuàng)建陣列

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

--create:創(chuàng)建陣列
--verbose:輸入詳細(xì)信息
/dev/md0:創(chuàng)建后的陣列的設(shè)備名
level:要?jiǎng)?chuàng)建的 RAID 的級別,這里使用模式 1
raid-devices:指定 RAID 副本的磁盤數(shù)。在這里指定了 2 ,意思是平時(shí)有兩個(gè)磁盤在工作。
如果以后添加了第三塊硬盤,那么第三塊硬盤將作為備用磁盤。當(dāng)工作中的兩塊磁盤有一塊壞了,第三塊將立刻啟動(dòng),并將完好的一塊的內(nèi)容復(fù)制到新的盤中。

查看陣列是否創(chuàng)建成功

由于上面命令創(chuàng)建后的陣列設(shè)備名為:/dev/md0,所以直接使用 fdisk -l 命令查看即可。

創(chuàng)建文件系統(tǒng)并掛載

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

掛載存儲到 /data 目錄

  1. mount /dev/md0 /data

保存陣列布局

完成以上步驟后,將陣列保存下來,在下次啟動(dòng)的時(shí)候自動(dòng)加載,

因此需要將陣列信息保存到 /etc/mdadm/mdadm.conf 文件中。可以通過以下命令來自動(dòng)掃描活動(dòng)陣列并追加文件:

mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
更新初始RAM文件系統(tǒng)(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.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容