fdisk分区磁盘、挂载

挂载磁盘

[root@gzgy-pp-wpmw028183 ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 558.4G  0 disk 
├─sda1            8:1    0   200M  0 part /boot
└─sda2            8:2    0   547G  0 part 
  ├─centos-root 253:0    0   465G  0 lvm  /
  ├─centos-swap 253:1    0    32G  0 lvm  [SWAP]
  └─centos-home 253:2    0    50G  0 lvm  /home
sdb               8:16   0   1.1T  0 disk
[root@gzgy-pp-wpmw028183 ~]# df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs   32G     0   32G   0% /dev
tmpfs                   tmpfs      32G     0   32G   0% /dev/shm
tmpfs                   tmpfs      32G   11M   32G   1% /run
tmpfs                   tmpfs      32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs       465G  3.9G  461G   1% /
/dev/sda1               xfs       197M  129M   69M  66% /boot
/dev/mapper/centos-home xfs        50G   33M   50G   1% /home
tmpfs                   tmpfs     6.3G     0  6.3G   0% /run/user/0
tmpfs                   tmpfs     6.3G     0  6.3G   0% /run/user/1000
tmpfs                   tmpfs     6.3G     0  6.3G   0% /run/user/1001

fdisk分区

[root@gzgy-pp-wpmw028183 ~]# fdisk /dev/sdb 
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 0x63826ade.

Command (m for help): p

Disk /dev/sdb: 1199.2 GB, 1199168290816 bytes, 2342125568 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: 0x63826ade

   Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-2342125567, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-2342125567, default 2342125567): 
Using default value 2342125567
Partition 1 of type Linux and of size 1.1 TiB is set

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

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

[root@gzgy-pp-wpmw028183 ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 558.4G  0 disk 
├─sda1            8:1    0   200M  0 part /boot
└─sda2            8:2    0   547G  0 part 
  ├─centos-root 253:0    0   465G  0 lvm  /
  ├─centos-swap 253:1    0    32G  0 lvm  [SWAP]
  └─centos-home 253:2    0    50G  0 lvm  /home
sdb               8:16   0   1.1T  0 disk 
└─sdb1            8:17   0   1.1T  0 part

格式化

[root@gzgy-pp-wpmw028183 ~]# mkfs.xfs /dev/sdb1 
meta-data=/dev/sdb1              isize=512    agcount=4, agsize=73191360 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=292765440, imaxpct=5
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=142951, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

挂载

拿到blkid
[root@gzgy-pp-wpmw028183 ~]# blkid
/dev/sda1: UUID="98b0037f-61d6-4e05-923f-154a503244aa" TYPE="xfs" 
/dev/sda2: UUID="0GyDk1-q6pW-tob0-z0e0-HU7Z-TPc0-XRtnjd" TYPE="LVM2_member" 
/dev/sdb1: UUID="009b081d-e143-435e-aa88-7cf835fded71" TYPE="xfs" 
/dev/mapper/centos-root: UUID="cc3ed6fc-ae6a-402f-95ad-2b3048f50aa0" TYPE="xfs" 
/dev/mapper/centos-swap: UUID="05bfd133-1aa9-46dc-bff7-05abbdbc8ee4" TYPE="swap" 
/dev/mapper/centos-home: UUID="3fab30f1-d83e-4dc3-ab1f-e4b7c60274a9" TYPE="xfs" 
[root@gzgy-pp-wpmw028183 ~]# vi /etc/fstab 
[root@gzgy-pp-wpmw028183 ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Thu Jul 18 12:23:42 2024
#
# 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 /                       xfs     defaults        0 0
UUID=98b0037f-61d6-4e05-923f-154a503244aa /boot                   xfs     defaults        0 0
/dev/mapper/centos-home /home                   xfs     defaults        0 0
/dev/mapper/centos-swap swap                    swap    defaults        0 0
UUID="009b081d-e143-435e-aa88-7cf835fded71" /data xfs     defaults        0 0
# 新增行将sdb1的uuid写入永久挂载文件中

挂载完成

[root@gzgy-pp-wpmw028183 data]# lsblk 
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 558.4G  0 disk 
├─sda1            8:1    0   200M  0 part /boot
└─sda2            8:2    0   547G  0 part 
  ├─centos-root 253:0    0   465G  0 lvm  /
  ├─centos-swap 253:1    0    32G  0 lvm  [SWAP]
  └─centos-home 253:2    0    50G  0 lvm  /home
sdb               8:16   0   1.1T  0 disk 
└─sdb1            8:17   0   1.1T  0 part /data
[root@gzgy-pp-wpmw028183 data]# df -Th
Filesystem              Type      Size  Used Avail Use% Mounted on
devtmpfs                devtmpfs   32G     0   32G   0% /dev
tmpfs                   tmpfs      32G     0   32G   0% /dev/shm
tmpfs                   tmpfs      32G   11M   32G   1% /run
tmpfs                   tmpfs      32G     0   32G   0% /sys/fs/cgroup
/dev/mapper/centos-root xfs       465G  3.9G  461G   1% /
/dev/sda1               xfs       197M  129M   69M  66% /boot
/dev/mapper/centos-home xfs        50G   33M   50G   1% /home
tmpfs                   tmpfs     6.3G     0  6.3G   0% /run/user/0
tmpfs                   tmpfs     6.3G     0  6.3G   0% /run/user/1000
tmpfs                   tmpfs     6.3G     0  6.3G   0% /run/user/1001
/dev/sdb1               xfs       1.1T   33M  1.1T   1% /data

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值