服务器新硬盘如何挂在,Ubuntu服务器挂载新硬盘的步骤
挂载的具体步骤如下。
1、测试硬盘是否已连接
首先先查看硬盘信息。sda是虚拟的第一块硬盘,sdb是第二块硬盘,以此类推。
root@zhang:~# ls -l
/dev/sd*
brw-rw---- 1 root disk 8,
0 2013-08-13 08:33 /dev/sda
brw-rw---- 1 root disk 8,
1 2013-08-13 08:33 /dev/sda1
brw-rw---- 1 root disk 8,
2 2013-08-13 08:33 /dev/sda2
brw-rw---- 1 root disk 8,
5 2013-08-13 08:33 /dev/sda5
brw-rw---- 1 root disk 8,
16 2013-08-13 08:33 /dev/sdb
#此命令测试linux系统是否能找到挂载的未分区硬盘
root@zhang:~# hdparm -I
/dev/sdb
#这个是未挂载之前的硬盘信息
root@zhang:~# fdisk
-l
Disk /dev/sda: 8589 MB,
8589934592 bytes
255 heads, 63
sectors/track, 1044 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0x000cf88c
Device Boot Start End
Blocks Id System
/dev/sda1 * 1 994 7977984
83 Linux
Partition 1 does not end
on cylinder boundary.
/dev/sda2 994 1045 407553
5 Extended
/dev/sda5 994 1045 407552
82 Linux swap / Solaris
Disk /dev/sdb: 8589 MB,
8589934592 bytes
255 heads, 63
sectors/track, 1044 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0x00000000
Disk /dev/sdb doesn't
contain a valid partition table
2、创建硬盘分区
root@zhang:~# fdisk
/dev/sdb
Device contains neither a
valid DOS partition table, nor Sun, SGI or OSF
disklabel
Building a new DOS
disklabel with disk identifier 0xcbd0c60e.
Changes will remain in
memory only, until you decide to write them.
After that, of course,
the previous content won't be recoverable.
Warning: invalid flag
0x0000 of partition table 4 will be corrected by
w(rite)
WARNING: DOS-compatible
mode is deprecated. It's strongly recommended to
switch
off the mode (command 'c') and change display units
to
sectors
(command 'u').
# 输入m,查看帮助信息 Command (m
for help): m
Command
action
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)
#查看sdb这块硬盘的分区
Command (m for help):
p
Disk /dev/sdb: 8589 MB,
8589934592 bytes
255 heads, 63
sectors/track, 1044 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0xcbd0c60e
Device Boot Start End
Blocks Id System
#创建sdb这块硬盘的分区
Command (m for help):
n
Command
action
e
extended
p
primary partition (1-4)
p
Partition number (1-4):
1
First cylinder (1-1044,
default 1):
Using default value
1
Last cylinder, +cylinders
or +size{K,M,G} (1-1044, default 1044):
Using default value
1044
#查看创建sdb硬盘的分区
Command (m for help):
p
Disk /dev/sdb: 8589 MB,
8589934592 bytes
255 heads, 63
sectors/track, 1044 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0xcbd0c60e
Device Boot Start End
Blocks Id System
/dev/sdb1 1 1044 8385898+
83 Linux
#保存退出,分区创建结束。
Command (m for help):
w
The partition table has
been altered!
Calling ioctl() to
re-read partition table.
Syncing
disks.
#再用fdisk
-l查看硬盘信息就可以看到sdb1新分区了
root@zhang:~# fdisk
-l
Disk /dev/sda: 8589 MB,
8589934592 bytes
255 heads, 63
sectors/track, 1044 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0x000cf88c
Device Boot Start End
Blocks Id System
/dev/sda1 * 1 994 7977984
83 Linux
Partition 1 does not end
on cylinder boundary.
/dev/sda2 994 1045 407553
5 Extended
/dev/sda5 994 1045 407552
82 Linux swap / Solaris
Disk /dev/sdb: 8589 MB,
8589934592 bytes
255 heads, 63
sectors/track, 1044 cylinders
Units = cylinders of
16065 * 512 = 8225280 bytes
Sector size
(logical/physical): 512 bytes / 512 bytes
I/O size
(minimum/optimal): 512 bytes / 512 bytes
Disk identifier:
0xcbd0c60e
Device Boot Start End
Blocks Id System
/dev/sdb1 1 1044 8385898+
83 Linux
3、格式化硬盘
root@zhang:~# mkfs -t
ext4 /dev/sdb1
mke2fs 1.41.11
(14-Mar-2010)
文件系统标签=
操作系统:Linux
块大小=4096
(log=2)
分块大小=4096
(log=2)
Stride=0 blocks, Stripe
width=0 blocks
524288 inodes, 2096474
blocks
104823 blocks (5.00%)
reserved for the super user
第一个数据块=0
Maximum filesystem
blocks=2147483648
64 block
groups
32768 blocks per group,
32768 fragments per group
8192 inodes per
group
Superblock backups stored
on blocks:
32768,
98304, 163840, 229376, 294912, 819200, 884736,
1605632
正在写入inode表:
完成
Creating journal (32768
blocks): 完成
Writing superblocks and
filesystem accounting information: 完成
This filesystem will be
automatically checked every 29 mounts or
180 days, whichever comes
first. Use tune2fs -c or -i to override.
4、给新建的sdb1设置卷标命名,创建挂载点。
root@zhang:~# e2label
/dev/sdb1 /data
root@zhang:~# mkdir
/data
5、设置开机自动挂载
在上面一个步骤中,我已经把sdb1这个分区重新命名,当然也可以在设置自动挂载的时候用UUID。
root@zhang:~# ls -l
/dev/disk/
total 0
drwxr-xr-x 2 root root
280 2013-08-13 08:47 by-id
drwxr-xr-x 2 root root 60
2013-08-13 08:52 by-label
drwxr-xr-x 2 root root
180 2013-08-13 08:47 by-path
drwxr-xr-x 2 root root
100 2013-08-13 08:51 by-uuid
#查看设置的卷标名称,这里有上一步中命名的分区/data
root@zhang:~# ls -l
/dev/disk/by-label/
total 0
lrwxrwxrwx 1 root root 10
2013-08-13 08:52 \x2fdata -> ../../sdb1
#查看各个分区的uuid号
root@zhang:~# ls -l
/dev/disk/by-uuid/
total 0
lrwxrwxrwx 1 root root 10
2013-08-13 08:33 b6dbd10c-7995-4b3d-abf0-2da1622298da ->
../../sda1
lrwxrwxrwx 1 root root 10
2013-08-13 08:33 d0d8b0bf-dc99-4d38-937d-f34d88072ce9 ->
../../sda5
lrwxrwxrwx 1 root root 10
2013-08-13 08:52 f90991b0-1082-45d8-b00d-87dceb81115e ->
../../sdb1
#设置开机自动挂载分区sdb1
root@zhang:~# vi
/etc/fstab
# /etc/fstab: static file
system information.
#
# Use 'blkid -o value -s
UUID' to print the universally unique identifier
# for a device; this may
be used with UUID= as a more robust way to name
# devices that works even
if disks are added and removed. See fstab(5).
#
#
proc /proc proc
nodev,noexec,nosuid 0 0
# / was on /dev/sda1
during installation
UUID=b6dbd10c-7995-4b3d-abf0-2da1622298da
/ ext4 errors=remount-ro 0 1
# swap was on /dev/sda5
during installation
UUID=d0d8b0bf-dc99-4d38-937d-f34d88072ce9
none swap sw 0 0
LABEL=/data /data ext4
defaults 0 2
#或者用UUID,效果都是一样的。
#UUID=f90991b0-1082-45d8-b00d-87dceb81115e
/data ext4 defaults 0 2
6、重新启动查看挂载结果
root@zhang:~# df
-lh
Filesystem Size Used
Avail Use% Mounted on
/dev/sda1 7.5G 1.5G 5.7G
20% /
none 243M 216K 243M 1%
/dev
none 247M 0 247M 0%
/dev/shm
none 247M 56K 247M 1%
/var/run
none 247M 0 247M 0%
/var/lock
none 247M 0 247M 0%
/lib/init/rw
/dev/sdb1 7.9G 146M 7.4G
2% /data
#挂载成功
服务器新硬盘如何挂在,Ubuntu服务器挂载新硬盘的步骤相关推荐
- 千牛文件已上传服务器,千牛怎样挂在云服务器上
千牛怎样挂在云服务器上 内容精选 换一换 本节为您介绍如何通过控制台提供的远程登录功能(即VNC方式)登录到弹性云服务器上.如果您的弹性云服务器是采用密钥方式鉴权,请在登录前先使用密钥文件解析登录密码 ...
- Ubuntu系统挂载固态硬盘
Ubuntu系统挂载固态硬盘 适用场景: Ubuntu操作系统已安装在机械硬盘,需挂载固态硬盘加快编译代码速度. 目录: (一)安装固态硬盘 (二)查看自己的硬盘信息 (三)创建挂载的目录(其实在ub ...
- 千牛文件在服务器上,千牛挂在云服务器
千牛挂在云服务器 内容精选 换一换 云耀云服务器(Halo Elastic Cloud Server,HECS)是可以快速搭建简单应用的新一代云服务器,具备独立.完整的操作系统和网络功能.提供快速地应 ...
- ubuntu服务器ftp无法上传文件,ubuntu服务器上传文件ftp
ubuntu服务器上传文件ftp 内容精选 换一换 通过Web浏览器登录主机,提供协同分享.文件传输.文件管理和预置命令等功能.用户在主机上执行的所有操作,被云堡垒机记录并生成审计数据.协同分享指会话 ...
- linux 服务器版 树莓派 加桌面,给Ubuntu服务器版安装GNOME桌面
如果在数据中心使用Ubuntu服务器,那么您可能正在使用终端专用接口.对那些熟悉命令行的人来说,使用命令行更好.但是,如果你即想使用Ubuntu服务器,但更喜欢GUI界面呢?幸运的是,在Ubuntu服 ...
- Ubuntu下挂载外部硬盘作为系统扩展使用
初次学习Linux时候,给虚拟机分配的磁盘空间都不会太大,随着学习的深入,所需要的磁盘空间不够用,就需要扩容. 扩容也分为在本身磁盘基础上扩大Linux的使用容量,和跨磁盘扩容. 我使用的是新加外部硬 ...
- 命令点亮硬盘灯_macOS下移动硬盘无法挂载且硬盘灯一直闪烁的解决方法
致力于成为您终身的苹果管家 点击上方蓝字 关注我们 小编近日遇到一个诡异的问题,小编的移动硬盘不定期的会自动断开,提示未正常拔出,实际上一直没有动过连接线,然后硬盘一直处于未加载的状态,硬盘灯也一直 ...
- 红旗linux挂载硬盘命令,红旗6sp1修改默认挂载的硬盘分区
红旗6sp1修改默认挂载的硬盘分区 发布时间:2008-05-01 14:06:48来源:红联作者:荷溪客 昨天更新安装上了红旗6.0sp1,安装完成后,系统默认挂载了硬盘分区如下: LABEL=/1 ...
- windows硬盘linux无法挂载,关于linux:Ubuntu无法挂载Windows硬盘甚至Windows在双启动时正常关闭...
我的问题是关于Ubuntu-16.04. 它显示错误 - Error mounting /dev/sda5 at /media/***/New Volume: Command-line `mount ...
最新文章
- linux挂载media装服务,CentOS8服务器入门系列教程(五):Linux挂载光盘、yum安装软件包...
- JQUERY使用技巧~总结
- 线索二叉树(基于链表存储树结点)
- ROS初学笔记 - C++11与PCL库冲突问题
- ios开发text kit_IOS开发入门之TextKit详解
- 上帝就在机器里:复杂算法背后隐藏的可怕现实
- 让XCode的Stack Trace信息可读
- HTML 4.01/XHTML 1.0标签列表
- 《Spark大数据分析实战》——第2章Spark开发与环境配置
- STL--deque用法
- VVC/JEM代码学习16:xCheckRDCostMerge2Nx2N
- VB6SP6极度精简兼容绿色版
- 世界银行264个国家1437项统计指标
- android 换肤 字体颜色,Android换肤
- Linux 登录 帐号 cmccedu 无线,CMCC CMCC-EDU路由器绑定自动登录方法详细教程!
- STM8S103之tim2捕获周期
- 网易云音乐打卡2.0(一天300首)10级指日可待
- 计算摄影——图像超分
- 记Git报错-Everything up-to-date
- 音频服务器未能正常启动,Windows10系统音频服务未启动问题彻底解决方法
热门文章
- 重点做EUR/USD、EUR/JPY、GBP/USD。
- Spring之AOP(面向切面编程)_入门Demo
- 面向对象风格的合理架构
- 五种开源协议的比较(BSD_Apache_GPL_LGPL_MIT)
- 社交网站 分享 +button
- freebsd下支持LATEX书写数学公式的网站搭建
- opensips mysql 版本_Opensips-1.11版本安装过程
- plsql developer 查看存储过程执行计划_产品简介 | X-Developer一站式研发效能管理平台...
- extjs给panel添加滚动条_extjs.treePanel在ie9下滚动条的显示问题-阿里云开发者社区...
- KafkaProducer介绍