查看系统硬盘挂载情况 : lsblk -f
lsblk分别是(老师不离开)的首字母这样比较好记。
sda
├─sda1 ext4 7cc94e03-8b1a-4845-97fb-49a2c39afd8c /boot
├─sda2 ext4 fe1d0eea-50ea-4d44-853b-1c39e5129021 /
├─sda3 ext4 df147f0a-efbd-4370-8e69-471b81a6ee7c /mnt/disk1
├─sda4
├─sda5 ext4 ea0d589d-a329-4bfc-a00b-11c00351765a /mnt/disk2
└─sda6 swap f306ece0-a790-41d7-b685-63585b8534e4 [SWAP]
交换分区:当有大量数据需要写入内存,但内存不足时,剩余的数据将写入交换分区
交换分区的说明:在大数据集群中安装集群之前将交换分区关闭掉。
1.在vm虚拟机中双击硬盘
2.添加一个硬盘
3:点击确定
这里设置你的硬盘空间
看你图上的路径是否与图下所示的路径相同
路径相同的话直接确认保存
fdisk/dev/sdb
[root@node01 ~]# 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 0x7a1242ed.
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(帮助)(n : 添加一个分区,d : 删除分区 w: 保存写入)
Command (m for help): n(添加分区)
Command action
e extended
p primary partition (1-4)
p(设置分区的类型)
Partition number (1-4): 1(第一个分区)
First cylinder (1-1305, default 1): 1(第一个分区的起始位置)
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): 650(第一个分区的结束位置)
Command (m for help): n(添加分区)
Command action
e extended
p primary partition (1-4)
p(设置分区的类型)
Partition number (1-4): 2(第二个分区)
First cylinder (651-1305, default 651): (第二个分区的起始位置)
Using default value 651
Last cylinder, +cylinders or +size{K,M,G} (651-1305, default 1305): (第二个分区的结束位置)
Using default value 1305
Command (m for help): w(保存)
The partition table has been altered!
查看新分区
[root@node01 ~]# fdisk -l
Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 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: 0x7a1242ed
Device Boot Start End Blocks Id System
/dev/sdb1 1 650 5221093+ 83 Linux
/dev/sdb2 651 1305 5261287+ 83 Linux
对新分区进行格式化
mkfs -t ext4 /dev/sdb1
[root@node01 ~]# mkfs -t ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
326400 inodes, 1305273 blocks
65263 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=1337982976
40 block groups
32768 blocks per group, 32768 fragments per group
8160 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 38 mounts or
格式完毕后 磁盘会分配UUID
[root@node01 ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sdb
├─sdb1 ext4 10023089-17e3-4dbf-af6a-447b7e2011d2
└─sdb2
mount /dev/sdb1 /mnt/disk3
mount /dev/sdb2 /mnt/disk4
开机自动挂载
修改vi /etc/fstab 文件,在文件中添加自动挂载配置
注:标注的ID跟前边查出的ID相对应
保存退出
重新挂载系统内所有硬盘
mount -a
现在就可以实现开机自动挂载。