一、fdisk-l
这个命令会列出当前分区和配置。
[root@cql ~]# fdisk -l
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: 0x000e3d27
Device Boot Start End Blocks Id System
/dev/sda1 1 914 7340032 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 914 1437 4194304 82 Linux swap / Solaris
/dev/sda3 * 1437 2611 9436160 83 Linux
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: 0x00000000
/dev/sdb就是我新添加的硬盘
二、格式化:
[root@cql ~]# mkfs -t ext4 /dev/sdb
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
591008 inodes, 2361547 blocks
118077 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2420113408
73 block groups
32768 blocks per group, 32768 fragments per group
8096 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.
三、挂载硬盘:
新建文件夹:mkdir /data2
将硬盘挂载到data2下
mount /dev/sdb /data2
四、加入开机自动
我是通过修改/etc/fstab文件,加入开机自动的,反正方法各种各样,都可以的,随自己的心情~
首先查看分区的UUID
[root@cql ~]# blkid
/dev/sda3: UUID="16046051-6a05-4e6b-b5d2-b64258f5e6d2" TYPE="ext4"
/dev/sda1: UUID="1573581f-e2d5-4f7c-a2de-da6e0eb94359" TYPE="ext4"
/dev/sda2: UUID="a0b44529-1476-4cd7-a009-51b879ba163a" TYPE="swap"
/dev/sdb1: UUID="f124b1f5-16df-4d68-bdc4-41aa08562111" TYPE="ext4"
编辑
[root@cql ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Sep 17 22:40:58 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=16046051-6a05-4e6b-b5d2-b64258f5e6d2 / ext4 defaults 1 1
UUID=1573581f-e2d5-4f7c-a2de-da6e0eb94359 /u01 ext4 defaults 1 2
UUID=a0b44529-1476-4cd7-a009-51b879ba163a swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
UUID=f124b1f5-16df-4d68-bdc4-41aa08562111 /u01 ext4 defaults 1 2
~
"/etc/fstab" 16L, 899C written
[root@cql ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Sun Sep 17 22:40:58 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=16046051-6a05-4e6b-b5d2-b64258f5e6d2 / ext4 defaults 1 1
UUID=1573581f-e2d5-4f7c-a2de-da6e0eb94359 /u01 ext4 defaults 1 2
UUID=a0b44529-1476-4cd7-a009-51b879ba163a swap swap defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
sysfs /sys sysfs defaults 0 0
proc /proc proc defaults 0 0
UUID=f124b1f5-16df-4d68-bdc4-41aa08562111 /u01 ext4 defaults 1 2
重启,确认结果~
[root@cql ~]# reboot
Broadcast message from root@cql
(/dev/pts/3) at 21:50 ...
The system is going down for reboot NOW!
[root@cql ~]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext3 8.9G 4.0G 4.5G 48% /
tmpfs tmpfs 931M 72K 931M 1% /dev/shm
/dev/sda1 ext3 8.9G 149M 8.3G 2% /u01
/dev/sdb1 ext3 8.9G 149M 8.3G 2% /u01
本文由 创作,采用 知识共享署名4.0 国际许可协议进行许可。本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名。最后编辑时间为:
2020/05/12 01:57