在内网主机Centos 6.5新增一个50G硬盘 (搭建在CAS服务器,直接新增存储)
新增一块磁盘主要需要做的有三步:格式化磁盘----分区----格式化分区----挂载
查看新增磁盘
[root@LX ~]# fdisk -l
Disk /dev/vda: 85.9 GB, 85899345920 bytes
16 heads, 63 sectors/track, 166440 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005239a
Device Boot Start End Blocks Id System
/dev/vda1 * 3 2083 1048576 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/vda2 2083 18727 8388608 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/vda3 18727 166441 74447872 83 Linux
Partition 3 does not end on cylinder boundary.
Disk /dev/vdb: 53.7 GB, 53687091200 bytes
16 heads, 63 sectors/track, 104025 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
[root@LX ~]#
格式化磁盘/dev/vdb
[root@LX ~]# mkfs.ext4 /dev/vdb
mke2fs 1.41.12 (17-May-2010)
/dev/sda is entire device, not just one partition!
Proceed anyway? (y,n) y
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=1 blocks, Stripe width=0 blocks
122101760 inodes, 488378646 blocks
24418932 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
14905 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, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@LX ~]
对磁盘/dev/vdb进行分区
[root@LX ~]#fdisk /dev/vdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x60e70d89.
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):p #(查看分区)
Disk /dev/vdb: 53.7 GB, 53687091200 bytes
16 heads, 63 sectors/track, 104025 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x60e70d89
Device Boot Start End Blocks Id System
Command (m for help):n #(新建分区)
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-104025, default 1):
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-104025, default 104025):
Using default value 104025
Command (m for help): p #(查看分区)
Disk /dev/vdb: 53.7 GB, 53687091200 bytes
16 heads, 63 sectors/track, 104025 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x60e70d89
Device Boot Start End Blocks Id System
/dev/vdb1 1 104025 52428568+ 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@LX ~]#
格式化分区/dev/vdb1
[root@LX ~]#mkfs.ext4 /dev/vdb1
mke2fs 1.41.12 (17-May-2010)
文件系统标签=
操作系统:Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
3276800 inodes, 13107142 blocks
655357 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
400 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, 2654208,
4096000, 7962624, 11239424
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
This filesystem will be automatically checked every 28 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@LX ~]#
临时挂载/dev/vdb1分区
[root@LX ~]#mount /dev/vdb1 /usr/local/
开机自动挂载/dev/vdb1分区
查看分区UUID:
[root@LX ~]# blkid
/dev/vda3: UUID="951e9559-2e00-4cdf-8ce0-e081dfb8c80a" TYPE="ext4"
/dev/vda1: UUID="244eaeab-3205-479b-bce1-d5ded856ac08" TYPE="ext4"
/dev/vda2: UUID="d58ccabf-1e64-40ea-a50c-62e42d4300bf" TYPE="swap"
/dev/vdb1: UUID="c9fd3a57-3a5b-458d-9f2d-15dd020847b7" TYPE="ext4"
[root@LX ~]#
修改挂载启动配置文件
[root@LX ~]# vi /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Jan 25 22:24:28 2019
#
# 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=951e9559-2e00-4cdf-8ce0-e081dfb8c80a / ext4 defaults 1 1
UUID=244eaeab-3205-479b-bce1-d5ded856ac08 /boot ext4 defaults 1 2
UUID=d58ccabf-1e64-40ea-a50c-62e42d4300bf swap swap defaults 0 0
UUID=c9fd3a57-3a5b-458d-9f2d-15dd020847b7 /usr/local ext4 defaults 1 2
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
:wq
配置完成,reboot重启
df-h 查看是否挂载成功。