Mount disk partitions

# Partition is larger than 2T, download software parted gdisk tool
 yum  install - the y-gdisk

Format Disk #
mkfs.xfs -f /dev/sdb


# Gdisk repartition 200G here divided into four partitions (p, n, w command)
gdisk /dev/sdb
#   Command (? for help): n
#   Partition number (1-128, default 1): 
#   First sector (34-5622988766, default = 2048) or {+-}size{KMGTP}: 
#   Last sector (2048-5622988766, default = 5622988766) or {+-}size{KMGTP}: +200G
#   Current type is 'Linux filesystem'
#   Hex code or GUID (L to show codes, Enter = 8300): 
#   Changed type of partition to 'Linux filesystem'
#   ...
#         Command (? for help): p
#         Disk /dev/sdb: 5622988800 sectors, 2.6 TiB
#         Logical sector size: 512 bytes
#         Disk identifier (GUID): D8F5B5AF-5335-45FE-B80A-5F53793DF843
#         Partition table holds up to 128 entries
#         First usable sector is 34, last usable sector is 5622988766
#         Partitions will be aligned on 2048-sector boundaries
#         Total free space is 3945267133 sectors (1.8 TiB)
#         
#         Number  Start (sector)    End (sector)  Size       Code  Name
#             1             2048        419 432 447    200.0 GiB    8300   Linux filesystem
#             2        419432448        838862847    200.0 GiB    8300   Linux filesystem
#             3        838862848       1258293247    200.0 GiB    8300   Linux filesystem
#             4       1258293248       1677723647    200.0 GiB    8300   Linux filesystem



# Format the new partition:
mkfs.xfs -f /dev/sdb1
mkfs.xfs -f /dev/sdb2
mkfs.xfs -f /dev/sdb3
mkfs.xfs -f /dev/sdb4

# Renamed
parted /dev/sdb
print # view the file system
name 1  mysql  
name 2  mongodb
name 3  kafka
name 4  redis

# Create a directory and mount
mkdir /mysql
mkdir /mongodb
mkdir /kafka
mkdir /redis

mount /dev/sdb1 /mysql
mount /dev/sdb2 /mongodb
mount /dev/sdb3 /kafka
mount /dev/sdb4 /redis

# Verification
df -th | grep mysql
 df -th | grip mongodb
 df -th | grip kafka
 df -th | grip Redis


# Join boot
cat << EOF >> /etc/fstab
/dev/sdb1 /mysql xfs     defaults        0 0
/dev/sdb2 /mongodb xfs    defaults        0 0
/dev/sdb3 /kafka xfs     defaults        0 0
/dev/sdb4 /redis xfs     defaults        0 0
EOF

 

Guess you like

Origin www.cnblogs.com/killall007/p/12657447.html