我们一开始在VMware上安装ubuntu系统,可能会分配比较小的磁盘空间,随着使用的时间增长,ubuntu系统里面的可以空间可能会越来越小,在影响原有的东西的情况下,我们怎么扩大磁盘空间呢?
一、在ubuntu系统关闭状态下(非挂起状态),点击“VM”->"Setting"->"hard disk"->"utilities"->"expand", 然后可以自行扩展到多少空间(是包括以前的空间);
二、开启ubuntu系统,进入系统之后,进入命令行终端。
1、fd -h 可以查看当前系统磁盘使用情况
-
jim@localhost:~$ df -h
-
Filesystem Size Used Avail Use% Mounted on
-
/dev/sda1 5.5G 3.7G 1.6G 70% /
-
udev 494M 4.0K 494M 1% /dev
-
tmpfs 201M 1.3M 199M 1% /run
-
none 5.0M 0 5.0M 0% /run/lock
-
none 501M 124K 501M 1% /run/shm
-
/dev/sda6 8.4G 3.8G 4.2G 48% /home
2、fdisk /dev/sda 对磁盘进行操作模式(添加分区、删除分区等操作)注意:要在root权限下
-
root@localhost:/home/jim# fdisk /dev/sda
-
-
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)
3、输入 n添加一个分区,会提示添加主分区还是逻辑分区。
4、输入p选择添加主分区。会提示输入分区号。
5、系统会提供一个默认未被使用的分区号,可以直接回车使用默认的分区号,也可以自己输入一个未被使用的分区号。
6、输入起始扇区和结束扇区,都直接回车用默认值。重启之后就会看到/dev/下会多出来sdax,x代表分区号。
7、切换到root用户,执行mkfs -t ext3 /dev/sdax,进行格式化。
8、挂载,mount /dev/sdax /home/work,再执行df -h 就可以看到上面添加的新分区了。
9、在/etc/fstab文件添加
/dev/sda4 /home/xair ext3 defaults, 0 1
使得系统启动时自动挂载
注意:如果第一次添加的分区很小,那就再重复添加一个分区,尺寸就会正常了,这个问题目前未能找到什么原因。
阅读(395) | 评论(0) | 转发(0) |