- A+
所属分类:未分类
上次aws给的云主机硬盘一般系统分区只占用一小部分,这就意味着要自己手动合理分区,如下:
[root@ip-172-31-28-5 ]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 40G 1.1G 37G 3% /
devtmpfs 7.3G 0 7.3G 0% /dev
tmpfs 7.2G 0 7.2G 0% /dev/shm
tmpfs 7.2G 8.3M 7.2G 1% /run
tmpfs 7.2G 0 7.2G 0% /sys/fs/cgroup
tmpfs 1.5G 0 1.5G 0% /run/user/22585
[root@ip-172-31-28-5 ]# fdisk -l
Disk /dev/xvda: 859.0 GB, 858993459200 bytes, 1677721600 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: 0x000273a4
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 83886079 41942016 83 Linux
我们通过lsblk查看一下:
[root@ip-172-31-28-5 ]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 800G 0 disk └─xvda1 202:1 0 40G 0 part /
如上,/dev/xvda这块硬盘一共859G,系统只是占用了不到50G,这时,就需要我们来重新划分剩余的空间到新分区
我这里是通过CFdisk 创建一个基本的 Linux 分区,如下:
cfdisk /dev/xvda
我们再通过上下键滑动到空闲的部位,如下图:
请使用箭头键选择 [ NEW ],然后按 Enter 键
然后按 Enter 键
我这里默认只要一个区,所有我直接把所有剩余空间全给了,按Enter键
选到write这一项,按Enter键
输入yes,按Enter键
通过左右键,先到Quit,按Enter键
然后,通过命令查看一下,新的分区好了没,如下:
[root@ip-172-31-28-5 xubo-iri]# fdisk -l
Disk /dev/xvda: 859.0 GB, 858993459200 bytes, 1677721600 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: 0x000273a4
Device Boot Start End Blocks Id System
/dev/xvda1 * 2048 83886079 41942016 83 Linux
/dev/xvda2 83886080 1677721599 796917760 83 Linux
然后我们使用partprobe命令加载一下新分区,如下:
[root@ip-172-31-28-5 ]# partprobe [root@ip-172-31-28-5 ]# ls /dev/xvda* /dev/xvda /dev/xvda1 /dev/xvda2
然后格式化/dev/xvda2(刚才创建的新分区)
[root@ip-172-31-28-5 ]# mkfs.ext4 /dev/xvda2 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 49807360 inodes, 199229440 blocks 9961472 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2346713088 6080 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, 20480000, 23887872, 71663616, 78675968, 102400000 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
然后挂载新分区
[root@ip-172-31-28-5]# mount /dev/xvda2 /data [root@ip-172-31-28-5]# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 1.1G 37G 3% / devtmpfs 7.3G 0 7.3G 0% /dev tmpfs 7.2G 0 7.2G 0% /dev/shm tmpfs 7.2G 8.3M 7.2G 1% /run tmpfs 7.2G 0 7.2G 0% /sys/fs/cgroup tmpfs 1.5G 0 1.5G 0% /run/user/22585 /dev/xvda2 748G 73M 710G 1% /data
好,到处结束
- 安卓客户端下载
- 微信扫一扫
- 微信公众号
- 微信公众号扫一扫