本文已参与 ⌈新人创作礼⌋ 活动,一起开启掘金创作之路
IP地址:172.X.X.182/24
操作系统:Centos6.5 X64
1、将剩余空间分出来
[root@localhost ~]# parted /dev/sda 慎重选择磁盘
GNU Parted 2.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mkpart
Partition name? []? data
File system type? [ext2]? ext4
Start? 226G
End? -1s
Warning: You requested a partition from 226GB to 598GB.
The closest location we can manage is 226GB to 598GB.
Is this still acceptable to you?
Yes/No? y
Warning: WARNING: the kernel failed to re-read the partition table on /dev/sda (Device or resource busy). As a
result, it may not reflect all of your changes until after reboot.
(parted)
(parted) print
Model: IBM ServeRAID M5015 (scsi)
Disk /dev/sda: 598GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Number Start End Size File system Name Flags
1 1049kB 211MB 210MB fat16 boot
2 211MB 420MB 210MB ext4
3 420MB 215GB 215GB ext4
4 215GB 226GB 10.7GB linux-swap(v1)
5 226GB 598GB 372GB data
(parted) quit
[root@localhost ~]#
2、格式化新分区
[root@localhost ~]# mkfs.ext4 /dev/sda5
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
22716416 inodes, 90842875 blocks
4542143 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
2773 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
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 38 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@localhost ~]#
3、挂载分区
[root@localhost /]# mkdir /data
[root@localhost /]#
[root@localhost /]# mount /dev/sda5 /data
[root@localhost /]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 197G 3.0G 184G 2% /
tmpfs tmpfs 32G 72K 32G 1% /dev/shm
/dev/sda2 ext4 194M 34M 151M 19% /boot
/dev/sda1 vfat 200M 260K 200M 1% /boot/efi
/dev/sda5 ext4 342G 195M 324G 1% /data
4、设置开机启动
[root@localhost /]# more /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Sep 1 01:51:35 2015
#
# 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=42d71b8d-2a7c-4dea-a263-11ef46658081 / ext4 defaults 1 1
UUID=6e8b3aba-a4bf-45be-b837-992f01345c86 /boot ext4 defaults 1 2
UUID=3C08-164F /boot/efi vfat umask=0077,shortname=winnt 0 0
UUID=6dc605cc-dff8-4812-b676-0e0eec225fc7 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
/dev/sda5/dataext4defaults0 0
5、重启系统测试挂载
[root@localhost /]# reboot
Connecting to 172.x.x.182:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Tue Sep 1 22:10:31 2015 from 172.16.94.196
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda3 ext4 197G 3.0G 184G 2% /
tmpfs tmpfs 32G 72K 32G 1% /dev/shm
/dev/sda2 ext4 194M 34M 151M 19% /boot
/dev/sda1 vfat 200M 260K 200M 1% /boot/efi
/dev/sda5 ext4 342G 195M 324G 1% /data
[root@localhost ~]#