磁盘挂载操作手册V1.3

Linux 磁盘挂载操作手册 V1.3


一. 查看磁盘状态

使用lsblk命令,发现存在空磁盘vdb

[root@tyzyk-gl-001 ~]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0              11:0    1 1024M  0 rom  
vda             252:0    0   40G  0 disk 
├─vda1          252:1    0    1G  0 part /boot
└─vda2          252:2    0   39G  0 part 
  ├─centos-root 253:0    0 35.1G  0 lvm  /
  └─centos-swap 253:1    0  3.9G  0 lvm  [SWAP]
vdb             252:16   0 1000G  0 disk 

使用df命令,发现磁盘无挂载

[root@tyzyk-gl-001 /]# df -HT
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs  8.3G     0  8.3G   0% /dev
tmpfs                   tmpfs     8.4G     0  8.4G   0% /dev/shm
tmpfs                   tmpfs     8.4G  816M  7.6G  10% /run
tmpfs                   tmpfs     8.4G     0  8.4G   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs        38G   15G   24G  38% /
/dev/vda1               xfs       1.1G  247M  817M  24% /boot
tmpfs                   tmpfs     1.7G   54k  1.7G   1% /run/user/0

确认空磁盘后,进行分区操作


二. 使用fdisk命令创建分区

使用fdisk命令进行分区,选择需要创建分区的磁盘/dev/vdb

fdisk /dev/vdb

依次输入

n

选择新建分区

p

选择新建主分区

回车

选择默认分区序号

回车

选择默认起始扇区

回车

选择默认大小(可设置分区大小,eg: +100G)

w

确认无误,写入分区表

[root@tyzyk-gl-001 /]# 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 0xc479a7c4.

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   g   create a new empty GPT partition table
   G   create an IRIX (SGI) partition table
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

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-2097151999, default 2048): 
Using default value 2048
Last sector, +sectors or +size{
   K,M,G} (2048-2097151999, default 2097151999): 
Using default value 2097151999
Partition 1 of type Linux and of size 1000 GiB is set

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

Calling ioctl() to re-read partition table.
Syncing disks.

以上操作无误,分区创建完成

使用lsblk和fdisk -l命令确认分区完成

[root@tyzyk-gl-001 /]# lsblk
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sr0              11:0    1 1024M  0 rom  
vda          
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值