一.查看新添加磁盘
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 |
[root@localhost /]# fdisk -l
磁盘 /dev/sda:53.7 GB, 53687091200 字节,104857600 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0009f1d1
设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 5253119 2113536 82 Linux swap / Solaris
/dev/sda3 5253120 104857599 49802240 83 Linux
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x12f9141b
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 10487807 5242880 83 Linux |
二.磁盘分区
?
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 |
[root@localhost /]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
命令(输入 m 获取帮助):n (n为创建分区)
Partition type:
p primary (1 primary, 0 extended, 3 free) (p为主分区)
e extended (e为扩展分区)
Select (default p): p
分区号 (2-4,默认 2):2
起始 扇区 (10487808-41943039,默认为 10487808):
将使用默认值 10487808
Last 扇区, +扇区 or +size{K,M,G} (10487808-41943039,默认为 41943039):+5G (分区的大小)
分区 2 已设置为 Linux 类型,大小设为 5 GiB
命令(输入 m 获取帮助):w (w保存设置)
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
正在同步磁盘。 |
三.磁盘格式化
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 |
[root@localhost /]# partprobe /dev/sdb2 (刷新分区表)
[root@localhost /]# mke2fs /dev/sdb2
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
327680 inodes, 1310720 blocks
65536 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=1342177280
40 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
Allocating group tables: 完成
正在写入inode表: 完成
Writing superblocks and filesystem accounting information: 完成 |
四.创建目录并挂载分区
?
1
2 |
[root@localhost /]# mkdir /soft
[root@localhost /]# mount /dev/sdb2 /soft |
五.设置开机自挂载
?
1
2 |
[root@localhost /]# vim /etc/fstab
/dev/sdb2 /soft xfs defaults 0 0 |
六.查看挂载
?
1
2
3
4
5
6
7
8
9
10 |
[root@localhost /]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/sda3 xfs 48G 3.7G 44G 8% /
devtmpfs devtmpfs 906M 0 906M 0% /dev
tmpfs tmpfs 914M 80K 914M 1% /dev/shm
tmpfs tmpfs 914M 8.9M 905M 1% /run
tmpfs tmpfs 914M 0 914M 0% /sys/fs/cgroup
/dev/sda1 xfs 497M 116M 382M 24% /boot
/dev/sdb1 ext2 5.0G 11M 4.7G 1% /dvd
/dev/sdb2 ext2 5.0G 10M 4.7G 1% /soft |
相关文章
猜你喜欢
- 个人网站服务器域名解析设置指南:从购买到绑定全流程 2025-06-10
- 个人网站搭建:如何挑选具有弹性扩展能力的服务器? 2025-06-10
- 个人服务器网站搭建:如何选择适合自己的建站程序或框架? 2025-06-10
- 64M VPS建站:能否支持高流量网站运行? 2025-06-10
- 64M VPS建站:怎样选择合适的域名和SSL证书? 2025-06-10
TA的动态
- 2025-07-10 怎样使用阿里云的安全工具进行服务器漏洞扫描和修复?
- 2025-07-10 怎样使用命令行工具优化Linux云服务器的Ping性能?
- 2025-07-10 怎样使用Xshell连接华为云服务器,实现高效远程管理?
- 2025-07-10 怎样利用云服务器D盘搭建稳定、高效的网站托管环境?
- 2025-07-10 怎样使用阿里云的安全组功能来增强服务器防火墙的安全性?
快网idc优惠网
QQ交流群
您的支持,是我们最大的动力!
热门文章
-
2025-05-29 38
-
2025-06-04 43
-
2025-05-29 15
-
asp.net实现上传图片时判断图片的模式GRB或CMYK的方法
2025-05-29 44 -
2025-05-25 67
热门评论