目录

1. 确认原硬盘节点

2. 加装物理硬盘,并再次查看硬盘信息

3. 创建分区

4、创建新的挂载点

5、手动挂载分区

6、添加访问权限

7、设置为开机自动挂载分区

具体加装过程:
1. 确认原硬盘节点
sudo fdisk -l

即原硬盘标识为sda

2. 加装物理硬盘,并再次查看硬盘信息

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

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 partition's 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 并回车,可查看分区信息,输入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 并回车,新建分区(此处,只新建一个分区),相关参数均选择推荐的默认值

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.
再次查看磁盘信息,新的分区为 /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 文件夹作为挂载节点

sudo mkdir /home/extend

5、手动挂载分区
挂载硬盘分区到挂载点

mount /dev/sdb1 /home/extend

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

6、添加访问权限
经过以上操作,该文件夹/extend只能由root账户进行访问,因此需要更改其访问权限,使得普通账户可以进行读写操作

sudo chmod 777 /home/extend

至此,所有用户均可对此文件夹进行读写,但只能读别人的文件而不能更改(人性化哈,在理)

7、设置为开机自动挂载分区
因为手动mount挂载在重启服务器后会失效,所以需要将分区信息写到/etc/fstab文件中让它开机自动挂载):

sudo vim /etc/fstab

在最后一行加入:/dev/sdb1 /home/extend ext4 defaults 0 2

(参照/home 的设置)

重启服务器,查看硬盘分区挂载是否正常。

原文:https://blog.csdn.net/cratial/article/details/87866602

为服务器加装机械硬盘相关推荐

  1. 电脑增加机械硬盘计算机管理,电脑加装机械硬盘直接插上就行了么

    电脑加装机械硬盘直接插上就行了么 电脑加装机械硬盘直接插上就可以了,电源接口和数据接口sata都要连接好, 并且硬盘需要固定好,要不摔倒容易损坏磁头. 具体装法如下: 1.将新的硬盘拿在手里,仔细看硬 ...

  2. 加装机械硬盘遇到的错误

    文章目录 前言 一.遇到的问题 二.修复 1.产生inaccessible boot device的原因: 2.无法进入系统的前提下,解决方法: 3.补充: 前言 原有固态硬盘PCIe接口,新加装机械 ...

  3. 戴尔计算机的机械硬盘容量,新款戴尔g3加装机械硬盘教程终极版

    对于想要给戴尔g3加装机械硬盘的用户来说,您首先需要准备一套专业的螺丝刀工具,毕竟现有很多计算机设备都有一些特殊的螺丝,所以,工具准备很重要哦.今天我们一起来看看 Dell G3 是否可以加装新的硬盘 ...

  4. 笔记本电脑电池怎么拆_笔记本电脑光驱位置加装机械硬盘,应该知道的事

    作为一个图文和视频创作者,每天都要用到笔记本电脑.要问我为什么不用台式机,虽然台式机价格便宜配置高,但是我每天都要往返家里和创作的地方,有时工作需要在家里继续进行,所以还是笔记本携带方便便捷,信息安全 ...

  5. 机械师T58-V加装机械硬盘

    机械师T58-V按装机械硬盘 准备工具 1.2.5英寸机械硬盘 2.螺丝刀 3.T58-V 笔记本 重要!!!文章仅供参考,操作过程中请注意用电安全,操作人和操作设备出现任何问题或差错与本人无关!!! ...

  6. 加装机械硬盘后如何给磁盘分区

    笔记本新加了西数的2T机械硬盘,但是在此电脑中无法查看到,因为还没有给磁盘分区. 参考教程:https://docs.microsoft.com/zh-cn/windows-server/storag ...

  7. 加装机械硬盘遇到的问题

    一台组装台式电脑,里面有500G,但是不够用,加装了一个2T的硬盘,接上线之后,用鲁大师装了个驱动就一直蓝屏 很怀疑就是这个驱动的问题,我的操作如下: 先以安全模式启动将那个USB3.1删除,在正常启 ...

  8. 联想y7000/r7000 2020款加装固态硬盘及硬盘分区,硬盘测速方法

    首先R7000和Y7000 (2020款) 内存支持替换32G×2,最大64G内存 (出厂内存均为3200MHz,英特尔平台默认仅支持2933运行频率) 硬盘能加装机械硬盘最大1TB SATA3.0 ...

  9. win10加装机械硬盘卡_联想笔记本加装固态,内存条,光驱位换装机械硬盘教程...

    1. 背景: 联想g580于13年入手,因学习需求需要经常使用ANSYS和CATIA等大型软件,老机子实在带不动,而且手头没有过多的资金,遂尝试加装固态以及内存等措施来续命. 2. 前期准备工作 2. ...

最新文章

  1. 首创模拟电子计算机,指导日本原子弹投射,这个大佬有点牛
  2. 博弈论笔记1:囚徒困境与纳什均衡
  3. python 人脸轮廓提取_实现人脸识别、人脸68个特征点提取,或许这个 Python 库能帮到你!...
  4. 左神算法:用一个栈实现另一个栈的排序(Java版)
  5. linux 安装jeakens_Chapter 2. OpenSSL的安装和配置学习笔记
  6. linux tar 命令使用
  7. # 字节数组转uint32_字节跳动客户端校招面经(21届秋招内推)
  8. 理解list和vector的区别
  9. Java中StringBuffer类的常用方法
  10. 根据error_log发现图片木马,被上传到图片文件夹
  11. 蓝桥杯省赛JavaB组真题
  12. 阿里云短信验证第三方接口(快速使用)
  13. python安装失败0x80070005_win10下载安装软件时提示“0x80070005-拒绝访问”
  14. linux下查看进程占用网络,linux怎么查看进程占用端口
  15. 遇到黑客勒索病毒怎么办
  16. JDK的多版本安装 及 切换
  17. 初识DE2-115(包含光盘demo)
  18. YoLo卷积神经网络各层计算,卷积层计算输入的图片大小是448*448*3输出224*224*64原因?
  19. 苹果微信分身版ios_苹果iOS系统的设备怎样安装两个微信
  20. python——class类和方法的用法详解

热门文章

  1. 韩果社 韩国elago三星i9220 Galaxy Note烤漆外壳 手机壳 手机套-淘宝网
  2. 崩坏星穹铁道电脑版 如何用模拟器在PC上玩崩坏星穹铁道手游教程
  3. 公司股权转让,变更股东要了解哪些?
  4. c语言中shmget相关函数,unix中共享内存(shmget的实现,非mmap)
  5. 阿里云 IP 地理位置库(淘宝IP库)实践(后篇)
  6. Buildroot OpenJDK 编译配置
  7. centos系统ftp服务器的目录权限,CentOS7 添加FTP用户并设置权限
  8. PDU发送短信 事例
  9. Hi3518ev200:开发环境测试,运行sample/venc抓拍图片
  10. android界面应用,Android界面及应用_手机_手机Android频道-中关村在线