解决方案:2.安装物理硬盘,然后再次检查硬盘信息

电脑杂谈  发布时间:2020-10-09 01:02:42  来源:网络整理

服务器硬盘安装_ibm服务器硬盘安装_服务器硬盘安装

关于此博客的注释:本文主要分享如何为服务器安装机械硬盘。

内容

具体安装过程:1.确认原始硬盘节点

sudofdisk-l

服务器硬盘安装

原始硬盘被标识为sda

2.安装物理硬盘,然后再次检查硬盘信息

服务器硬盘安装

新添加的硬盘显示为sdb,并且已经存在两个分区sdb1和sdb2

ibm服务器硬盘安装_服务器硬盘安装_服务器硬盘安装

3.创建分区

在创建分区之前,请删除两个现有分区sdb1和sdb2。

命令:sudo fdisk / dev / sdb

此命令用于分区管理,并且将显示类似以下内容的内容:

Command (m for help):   
这里按m获得帮助   
a   toggle a bootable flag   将分区设置为启动区   
b   edit bsd disklabel    编辑bsd的disklabel   
c   toggle the dos compatibility flag  设置该分区为dos分区   
d   delete a partition 删除分区   
l   list known partition types  列出已知的分区类型   
m   print this menu  打印帮助列表   
n   add a new partition 创建新分区   
o   create a new empty DOS partition table   
p   print the partition table查看分区信息   
q   quit without saving changes 退出不保存   
s   create a new empty Sun disklabel   
t   change a partitions system id改变分区类型   
u   change display/entry units   
v   verify the partition table   
w   write table to disk and exit 保存退出   
x   extra functionality (experts only)

输入p并按Enter查看分区信息,输入d删除其中一个分区,然后输入d删除另一个分区

amax@amax:~/.vnc$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): m
Help:
Generic
d delete a partition
F list free unpartitioned space
l list known partition types
n add a new partition
p print the partition table
t change a partition type
v verify the partition table
i print information about a partition
Misc
m print this menu
x extra functionality (experts only)
Script
I load disk layout from sfdisk script file
O dump disk layout to sfdisk script file
Save & Exit
w write table to disk and exit
q quit without saving changes
Create a new label
g create a new empty GPT partition table
G create a new empty SGI (IRIX) partition table
o create a new empty DOS partition table
s create a new empty Sun partition table
Command (m for help): p
Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D7CBEC0F-7AD1-4458-8DCE-735426FDFBFE
Device Start End Sectors Size Type
/dev/sdb1 34 262177 262144 128M Microsoft reserved
/dev/sdb2 264192 7814035455 7813771264 3.7T Microsoft basic data
Partition 1 does not start on physical sector boundary.
Command (m for help): d
Partition number (1,2, default 2): 2
Partition 2 has been deleted.
Command (m for help): p
Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D7CBEC0F-7AD1-4458-8DCE-735426FDFBFE
Device Start End Sectors Size Type
/dev/sdb1 34 262177 262144 128M Microsoft reserved
Partition 1 does not start on physical sector boundary.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): p
Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D7CBEC0F-7AD1-4458-8DCE-735426FDFBFE

输入n并按Enter键创建一个新分区(此处仅创建一个新分区),然后为相关参数选择建议的默认值。

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (34-7814037134, default 2048): 2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-7814037134, default 7814037134): 7814037134
Created a new partition 1 of type Linux filesystem and of size 3.7 TiB.
Command (m for help): p
Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D7CBEC0F-7AD1-4458-8DCE-735426FDFBFE
Device Start End Sectors Size Type
/dev/sdb1 2048 7814037134 7814035087 3.7T Linux filesystem
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

服务器硬盘安装_ibm服务器硬盘安装_服务器硬盘安装

再次检查磁盘信息,新分区为/ dev / sdb1


amax@amax:~/.vnc$ sudo fdisk -l
Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 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
Disklabel type: dos
Disk identifier: 0xfce56e52
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 976657 974610 475.9M 83 Linux
/dev/sda2 978942 128976895 127997954 61G 5 Extended
/dev/sda3 128976896 728977407 600000512 286.1G 83 Linux
/dev/sda4 728977408 3907028991 3178051584 1.5T 83 Linux
/dev/sda5 978944 128976895 127997952 61G 82 Linux swap / Solaris
Partition table entries are not in disk order.
Disk /dev/sdb: 3.7 TiB, 4000787030016 bytes, 7814037168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: D7CBEC0F-7AD1-4458-8DCE-735426FDFBFE
Device Start End Sectors Size Type
/dev/sdb1 2048 7814037134 7814035087 3.7T Linux filesystem

格式化分区

完成分区后,必须将硬盘格式化为Linux系统格式

命令:sudo mkfs -t ext4 / dev / sdb1

这里的格式是ext4文件格式,与另一个硬盘的文件格式一致

amax@amax:~/.vnc$ sudo mkfs -t ext4 /dev/sdb1
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 976754385 4k blocks and 244195328 inodes
Filesystem UUID: ed919d6a-9519-4a9a-8763-9f1e2dbeaacb
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

4、创建一个新的挂载点

为方便普通用户访问,请使用管理员权限在/ home目录中创建/ extend文件夹作为安装节点

服务器硬盘安装_服务器硬盘安装_ibm服务器硬盘安装

sudomkdir / home / extend

5、手动安装分区

将硬盘分区安装到安装点

挂载/ dev / sdb1 / home / extend

可以发现该文件夹的信息已更改为添加新硬盘的信息

服务器硬盘安装

6、添加访问权限

完成上述操作后,文件夹/扩展名只能由root帐户访问,因此需要更改其访问权限,以便普通帐户可以读写操作

sudo chmod 777 / home / extend

ibm服务器硬盘安装_服务器硬盘安装_服务器硬盘安装

此时,所有用户都可以读取和写入此文件夹,但是他们只能读取其他人的文件,而不能更改(Humanized Ha,在管理中)

7、设置为在启动时自动挂载分区

因为重新启动服务器后手动挂载将失败,所以您需要将分区信息写入/ etc / fstab文件以使其在引导后自动挂载):

sudo vim / etc / fstab

在最后一行添加:/ dev / sdb1 / home / extext ext4默认为0 2

(请参阅/ home设置)

服务器硬盘安装

重新启动服务器,并检查硬盘分区是否已正确安装。

主要参考资料:


本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/dianqi/article-324858-1.html

    相关阅读
      发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

      热点图片
      拼命载入中...