-
fdisk -l
-
[root@driver ~]# 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.
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-4194303999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303999, default 4194303999):
Using default value 4194303999
Partition 1 of type Linux and of size 2 TiB is set
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
[root@driver ~]# mkfs.ext4 /dev/vdb1
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
131072000 inodes, 524287744 blocks
26214387 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2671771648
16000 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, 214990848, 512000000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@driver ~]# mount /dev/vdb1
[root@driver ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/vda1 41931756 12220280 29711476 30% /
devtmpfs 498432 0 498432 0% /dev
tmpfs 508192 0 508192 0% /dev/shm
tmpfs 508192 6672 501520 2% /run
tmpfs 508192 0 508192 0% /sys/fs/cgroup
tmpfs 101640 0 101640 0% /run/user/0
/dev/vdb1 2064103824 81944 1959147948 1% /home
- 查看UUID
[root@driver ~]# sudo blkid /dev/vdb1
/dev/vdb1: UUID="bb40c14e-2b1b-4bfc-aa0a-xxxxxxxxxx" TYPE="ext4"
- 编辑
[root@driver ~]# vim /etc/fstab
#
# /etc/fstab
# Created by anaconda on Fri Jan 26 04:08:32 2018
#
# 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="bb40c14e-2b1b-4bfc-aa0a-7c620b67a6d4 /home
/dev/vdb1 /home ext4 default 0 1
- 如果想删除之前建立的分区
[root@driver ~]# 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.
Command (m for help): d
Selected partition 1
Partition 1 is deleted
Command (m for help): w
The partition table has been altered!