linux下创建及挂载磁盘

Last login: Thu Mar 19 14:59:18 2020

[root@i-A4D8E25D ~]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/vda2 292G 2.2G 290G 1% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 9.1M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
tmpfs 6.3G 0 6.3G 0% /run/user/0

[root@i-A4D8E25D ~]# fdisk -l

Disk /dev/vda: 322.1 GB, 322122547200 bytes, 629145600 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: 0x000504a5

Device Boot Start End Blocks Id System
/dev/vda1 2048 16779263 8388608 82 Linux swap / Solaris
/dev/vda2 * 16779264 629145599 306183168 83 Linux

Disk /dev/vdb: 777.4 GB, 777389080576 bytes, 1518338048 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: 0xbe340d96

Device Boot Start End Blocks Id System

[root@i-A4D8E25D ~]# 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):
First sector (2048-1518338047, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1518338047, default 1518338047):
Using default value 1518338047
Partition 1 of type Linux and of size 724 GiB is set

Command (m for help): v

Remaining 2047 unallocated 512-byte sectors

Command (m for help): ^C

[root@i-A4D8E25D ~]# fdisk -l

Disk /dev/vda: 322.1 GB, 322122547200 bytes, 629145600 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: 0x000504a5

Device Boot Start End Blocks Id System
/dev/vda1 2048 16779263 8388608 82 Linux swap / Solaris
/dev/vda2 * 16779264 629145599 306183168 83 Linux

Disk /dev/vdb: 777.4 GB, 777389080576 bytes, 1518338048 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: 0xbe340d96

Device Boot Start End Blocks Id System

[root@i-A4D8E25D ~]# 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
47448064 inodes, 189792256 blocks
9489612 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2338324480
5792 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@i-A4D8E25D ~]# mount /dev/vdb /home
[root@i-A4D8E25D ~]# df -h

Filesystem Size Used Avail Use% Mounted on
/dev/vda2 292G 2.2G 290G 1% /
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 0 32G 0% /dev/shm
tmpfs 32G 9.1M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
tmpfs 6.3G 0 6.3G 0% /run/user/0
/dev/vdb 713G 73M 677G 1% /home
[root@i-A4D8E25D ~]#

[root@i-A4D8E25D ~]# vi /etc/fstab

#/etc/fstab
#Created by anaconda on Wed Jun 13 11:34:54 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=761b6b92-9792-44f0-8fa4-3e7bfa46e98e / xfs defaults 0 0
UUID=447f3214-7716-4376-a9e2-db1aae12105d swap swap defaults 0 0

/dev/vdb /home ext4 defaults 0 0

[root@i-A4D8E25D ~]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值