安装virtual box
下载centos系统镜像文件
cd ~/VirtualBox VMs/yourVirtualMechineName
#重置为61440MB,即60GB
sudo VBoxManage modifyhd ./yourMechineName.vdi --resize 61440
开机,打开terminal
sudo fdisk -l /dev/sda
Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b5d76
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 33554431 15727616 8e Linux LVM
sudo fdisk /dev/sda
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
Partition number (3,4, default 3):
First sector (33554432-125829119, default 33554432):
Using default value 33554432
Last sector, +sectors or +size{K,M,G} (33554432-125829119, default 125829119):
Using default value 125829119
Partition 3 of type Linux and of size 44 GiB is set
Command (m for help):
Command (m for help): p
Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b5d76
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 33554431 15727616 8e Linux LVM
/dev/sda3 33554432 125829119 46137344 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
#重启
sudo mkfs -t ext4 /dev/sda3
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2883584 inodes, 11534336 blocks
576716 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2160066560
352 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
#查看信息
sudo fdisk -l | grep sd
Disk /dev/sda: 64.4 GB, 64424509440 bytes, 125829120 sectors
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 33554431 15727616 8e Linux LVM
/dev/sda3 33554432 125829119 46137344 83 Linux
mkdir ~/workspace
$ sudo mount /dev/sda3 ~/workspace
$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 14G 14G 346M 98% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 9.3M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 1014M 285M 730M 29% /boot
tmpfs 379M 8.0K 379M 1% /run/user/42
tmpfs 379M 0 379M 0% /run/user/1000
/dev/sda3 44G 53M 41G 1% /home/zhangzhiqiang
#设置开机自动挂载
$ sudo vim /etc/fstab
#添加
/dev/sda3 ~/workspace ext4 defaults 0 1