- 场景1:公司金山云服务器,由于数据量巨大,数据不能存在默认目录,只能重新挂一块数据盘进行存储,用到了分区
- 场景2:在虚拟环境中做镜像,空间不足,在exsi分配了一块盘给虚拟机后,需要使用本文的内容进行分区,才能使用这块盘
如下,这是云服务器,vdb盘就是还未被分区和使用的盘,如果不分区,是无法使用的。
root@ecs-5295 data]# fdisk -l
Disk /dev/vda: 42.9 GB, 42949672960 bytes, 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 label type: dos
Disk identifier: 0x000a18d3
Device Boot Start End Blocks Id System
/dev/vda1 2048 8194047 4096000 82 Linux swap / Solaris
/dev/vda2 * 8194048 83886079 37846016 83 Linux
Disk /dev/vdb: 107.4 GB, 107374182400 bytes, 209715200 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
下面进行分区,根据提示来即可
[root@ecs-5295 data]# fdisk /dev/vdb
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.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x0c36caaa.
Command (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-209715199, default 2048): 2048
Last sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): 209715199
Partition 1 of type Linux and of size 100 GiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
这样就分好了,然后进行格式化磁盘
[root@ecs-5295 data]# mkfs.ext4 /dev/vdb
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
6553600 inodes, 26214400 blocks
1310720 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2174746624
800 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
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
写入fstab文件
#
# /etc/fstab
# Created by anaconda on Mon Sep 4 16:13:12 2017
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=d3b7747c-23f4-47f5-9b90-eeb6faa412ea / ext4 defaults 1 1
UUID=959ab3ee-5bea-44c2-a908-c577a79e5bb9 swap swap defaults 0 0
/dev/vdb /ocloud ext4 defaults 0 0
重新加载fstable,并查看磁盘是否加载成功
mount -a
df -h
一般对于云服务器,挂载上,这块盘能用,目的就达到了。
云服务器挂载/dev/vdb磁盘_wzj的博客-CSDN博客_/dev/vdb是什么
标签:blocks,分区,bytes,dev,vdb,服务器,512,size From: https://www.cnblogs.com/sunnybowen/p/16717055.html