Centos系统下硬盘扩容

装好CentOS后,发现空间太小,怎样才能增加硬盘容量?那就是再建一个硬盘:

打开虚拟经济的设置添加硬盘

Centos系统下硬盘扩容

查看现有的磁盘空间

fdisk -l

[root@localhost ~]# fdisk -l

Disk /dev/sda: 21.5 GB,  bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x000e4bd8 Device Boot Start End Blocks Id System
/dev/sda1 * Linux
Partition does not end on cylinder boundary.
/dev/sda2 8e Linux LVM Disk /dev/sdb: MB, bytes
heads, sectors/track, cylinders
Units = cylinders of * = bytes
Sector size (logical/physical): bytes / bytes
I/O size (minimum/optimal): bytes / bytes
Disk identifier: 0x00000000

我添加的是/dev/sdb

给新加的硬盘进行分区

fdisk /dev/sdb

输入m ,可以查看帮助信息

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only) Command (m for help):

增加新的分区

command (m for help):n

选择基本信息分区,输入:p

Command (m for help): n
Command action
e extended
p primary partition (-)

回车

 First cylinder (-,default ):Enter
(这是回车是指分的默认大小)
写入并退出
command (m for help):w

然后格式化磁盘分区

 用ext4格式对/dev/sdb1进入格式化 

mkfs.ext4 /dev/sdb1

[root@localhost ~]# mkfs.ext4 /dev/sdb
mke2fs 1.41.12 (17-May-2010)
/dev/sdb is entire device, not just one partition!
无论如何也要继续? (y,n) y
/dev/sdb 已经挂载;will not make a 文件系统 here!
[root@localhost ~]#

因为我的扩展盘符已经挂上去了,在占用状态。

挂载分区

先创建一个挂载点

mkdir  /work

mount -t ext4 /dev/sdb1/work

查看挂载状态

df -h

[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 18G 11G .2G % /
tmpfs 932M 72K 932M % /dev/shm
/dev/sda1 485M 40M 421M % /boot
/dev/sdb .0G 138M .6G % /work
[root@localhost ~]#

将挂载的目录加入开机自动挂载

  /dev/sdb1 /work ext4 errors=remount-ro   

完成

上一篇:Spring3 MVC使用@ResponseBody的乱码问题及解决办法


下一篇:Python 列表元素里面含有字典或者列表进行排序