vmware 下为liunx增加磁盘空间

本文详细介绍了如何在Ubuntu系统中增加并格式化新的磁盘分区,并将其挂载到指定目录的过程。包括使用fdisk工具创建分区、mkfs.ext3进行格式化及挂载分区。

为ubuntu增加磁盘如下图所示:

输入sudo fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 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 identifier: 0x000a3991

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    80709631    40353792   83  Linux
/dev/sda2        80711678    83884031     1586177    5  Extended
/dev/sda5        80711680    83884031     1586176   82  Linux swap / Solaris

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders, total 20971520 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 identifier: 0x00000000

刚才添加的10G已经显示出来了。

sudo fdisk /dev/sdb

ommand (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-20971519, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-20971519, default 20971519): 
Using default value 20971519

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
myroot@ubuntu:~$ sudo fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders, total 83886080 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 identifier: 0x000a3991

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    80709631    40353792   83  Linux
/dev/sda2        80711678    83884031     1586177    5  Extended
/dev/sda5        80711680    83884031     1586176   82  Linux swap / Solaris

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
107 heads, 17 sectors/track, 11529 cylinders, total 20971520 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 identifier: 0x73667eff

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    20971519    10484736   83  Linux

格式化分区:

 sudo mkfs.ext3 /dev/sdb1
挂载分区到/opt目录,mount /dev/sdb1 /opt:

myroot@ubuntu:~$ df -lh
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        39G  4.0G   33G  11% /
udev            755M  4.0K  755M   1% /dev
tmpfs           305M  792K  304M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            762M  152K  762M   1% /run/shm
/dev/sdb1       9.9G  151M  9.2G   2% /opt


卸载/opt,sudo umount /opt



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值