linux 磁盘分区挂载

0.先mkdir创建挂载的路径

1.使用fdisk 创建分区

[root@box2 ~]# fdisk /dev/sdd
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
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): m
Command action
   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
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

Command (m for help): n
Partition number (1-128, default 1): 
First sector (34-937703054, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-937703054, default 937703054): 
Created partition 1


Command (m for help): p

Disk /dev/sdd: 480.1 GB, 480103981056 bytes, 937703088 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk label type: gpt
Disk identifier: CF1A3E07-295B-4CC8-B492-18BE26F0D6BB


#         Start          End    Size  Type            Name
 1         2048    937703054  447.1G  Linux filesyste 

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

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

2.格式化新建的分区

[root@box2 ~]# mkfs.ext4 /dev/sdd1
mke2fs 1.42.9 (28-Dec-2013)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
29310976 inodes, 117212625 blocks
5860631 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2264924160
3578 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@box2 ~]# 

3.修改fstab

#
# /etc/fstab
# Created by anaconda on Mon Mar 23 19:44:45 2020
#
# 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
#
/dev/mapper/centos-root /                       ext4    defaults        1 1
UUID=782ecdfc-bb10-4bbc-82b4-cf0ab83f7b52 /boot                   xfs     defaults        0 0
/dev/mapper/centos-swap swap                    swap    defaults        0 0
/dev/sdd1               /hahahahaha              ext4     defaults          0 0                                                                                         

4.mount -a验证

[root@box2 ~]# mount -a
[root@box2 ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 372.6G  0 disk 
├─sda1            8:1    0   500M  0 part /boot
└─sda2            8:2    0 372.1G  0 part 
  ├─centos-root 253:0    0 356.1G  0 lvm  /
  └─centos-swap 253:1    0    16G  0 lvm  [SWAP]
sdb               8:16   0 931.5G  0 disk 
sdc               8:32   0 931.5G  0 disk 
sdd               8:48   0 447.1G  0 disk 
└─sdd1            8:49   0 447.1G  0 part /hahahahaha
sde               8:64   0 447.1G  0 disk 

sdd1已挂载,完成

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值