linux下如何挂载硬盘?1.插入新硬盘 , 启动Linux服务器 , 使用fdisk -l 查看硬盘
#fdisk -l
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
2.格式化硬盘
#mkfs -t ext4 /dev/sdb
3.挂载硬盘
#mount 硬盘地址 要挂载的地址
#mount /dev/sdb /media/imgs
4.实现系统重启后自动挂载该分区
#vi /etc/fstab
在最后一行添加
/dev/sdb /media/imgs ext4 defaults 1 2
一、添加磁盘
添加加新硬盘重启服务器
添加完之后就可以重启机器了 , 如果你机器是开启的,进入系统并不能看见你刚添加的那块磁盘,只有等系统重启 , 重新加载之后才会显示安装的那块磁盘
二、进入系统
使用root用户进入系统
三、 查看硬盘信息
[root@localhost ~]# fdisk -l//磁盘命令
1
Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0x000c4cb5
Device BootStartEndBlocksIdSystem
/dev/sda1*16451200083Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2642611204584968eLinux LVM
Disk /dev/sdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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: 0xd0f5c869
Device BootStartEndBlocksIdSystem
/dev/sdb11261020964793+83Linux
Disk /dev/sdc: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
可以看到这台机器加载了三个磁盘sda、sdb、sdc
其中sda是初始磁盘 , sdb已经初始化且经过使用 , sdc是刚刚加载的,未格式化的新磁盘
四、创建新硬盘分区
[root@localhost ~]# fdisk /dev/sdc #进入磁盘
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x45a3cadb.
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').
Command (m for help): m
Command action
atoggle a bootable flag#设定可启动标记
bedit bsd disklabel
ctoggle the dos compatibility flag
ddelete a partition#删除一个分区
llist known partition types#各分区类型所对应的ID
mprint this menu#菜单
nadd a new partition#添加一个分区
ocreate a new empty DOS partition table
pprint the partition table#显示该磁盘下的当前分区信息
qquit without saving changes #不保存退出
screate a new empty Sun disklabel
tchange a partition's system id
uchange display/entry units
vverify the partition table
wwrite table to disk and exit #保存退出
xextra functionality (experts only)
1
2
3
4
推荐阅读
- 采耳视频素材直播,采耳视频播放
- 视频号的黑名单怎么去掉,视频号的黑名单是什么意思
- htmlstyle标签属性,style标签和style属性
- 汽车凝胶坐垫直播带货,汽车凝胶坐垫优缺点
- 进制转换代码java 进制转换代码c语言
- 微博的下载,微博的下载视频在哪
- 电脑顯卡怎么装,电脑显卡怎么装上去
- go语言学习数据 go语言实战
- 电脑版暴力迪吧怎么下载,暴力迪吧电脑游戏