经过查询信息:
Resourcesare lowon NN. Please add or free up more resources then turn off safe modemanually.NOTE: If you turn off safe mode before adding resources, the NNwillimmediately return to safe mode..
才知道是资源不足。估计是硬盘空间不足。当时为了节省空间。分了8G。
点击实用工具。选择扩容工具。
现在在虚拟机CentOS系统里看不到刚加入的磁盘空间;
我们使用命令查看到,改虚拟机CentOS系统里只有一个磁盘sda,有3个分区sda1、sda2,sda3在根目录下挂载了8G。
OK,现在我们来把刚新扩展的7G磁盘空间让它显示在系统中。
新建分区sda4,用n命令建个P类型的磁盘,然后用t命令更改ID为8e(LVM类别)。
[root@master~]# fdisk -l
Disk/dev/sda: 16.1 GB, 16106127360 bytes
255heads, 63 sectors/track, 1958 cylinders
Units= cylinders of 16065 * 512 = 8225280bytes
Sectorsize (logical/physical): 512 bytes /512 bytes
I/Osize (minimum/optimal): 512 bytes / 512bytes
Diskidentifier: 0x000b2584
DeviceBoot Start End Blocks Id System
/dev/sda1* 1 39 307200 83 Linux
Partition1 does not end on cylinderboundary.
/dev/sda239 788 6016000 83 Linux
Partition2 does not end on cylinderboundary.
/dev/sda3788 1045 2064384 82 Linux swap / Solaris
[root@master~]# fdisk /dev/sda
WARNING:DOS-compatible mode is deprecated.It's strongly recommended to
switchoff the mode (command 'c') and change display units to
sectors(command 'u').
Command(m for help): n
Commandaction
e extended
pprimary partition (1-4)
p
Selectedpartition 4
Firstcylinder (1045-1958, default 1045):
Usingdefault value 1045
Lastcylinder, +cylinders or +size{K,M,G}(1045-1958, default 1958):
Usingdefault value 1958
Command(m for help): t
Partitionnumber (1-4): 4
Hexcode (type L to list codes): 8e
Changedsystem type of partition 4 to 8e(Linux LVM)
Command(m for help): p
Disk/dev/sda: 16.1 GB, 16106127360 bytes
255heads, 63 sectors/track, 1958 cylinders
Units= cylinders of 16065 * 512 = 8225280bytes
Sectorsize (logical/physical): 512 bytes /512 bytes
I/Osize (minimum/optimal): 512 bytes / 512bytes
Diskidentifier: 0x000b2584
DeviceBoot Start End Blocks Id System
/dev/sda1* 1 39 307200 83 Linux
Partition1 does not end on cylinderboundary.
/dev/sda239 788 6016000 83 Linux
Partition2 does not end on cylinderboundary.
/dev/sda3788 1045 2064384 82 Linux swap / Solaris
/dev/sda41045 1958 7339027 8e Linux LVM
Command(m for help): w
Thepartition table has been altered!
Callingioctl() to re-read partition table.
WARNING:Re-reading the partition tablefailed with error 16: Device or resource busy.
Thekernel still uses the old table. Thenew table will be used at
thenext reboot or after you runpartprobe(8) or kpartx(8)
Syncingdisks.
[root@master~]# reboot
再次执行"fdisk-l"命令查看磁盘的分区信息,这时已经能够看到新创建的磁盘分区/dev/sda4了。要想在扩展分区下创建文件系统,先要在扩展分区下创建新的逻辑分区,我们继续使用"fdisk/dev/sda"命令创建逻辑分区:如下图所示,在"Commandaction"提示下我们输入"l"创建一个逻辑分区,分区大小保持默认即可,最后执行"w"命令写入分区信息。
[root@master~]# mkfs -t ext3 /dev/sda4
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
458752 inodes, 1834756 blocks
91737 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1879048192
56 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
Writinginode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
Thisfilesystem will be automatically checked every 26 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@master ~]#mount /dev/sda4 /root
[root@master ~]# fd-h
-bash: fd: commandnot found
[root@master ~]# df-h
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 5.7G 4.4G 1.1G 81% /
tmpfs 764M 76K 764M 1% /dev/shm
/dev/sda1 291M 35M 242M 13% /boot
df: `/root/.gvfs':No such file or directory
/dev/sda4 6.9G 144M 6.4G 3% /root