1818IP-服务器技术教程,云服务器评测推荐,服务器系统排错处理,环境搭建,攻击防护等

当前位置:首页 - Linux系统 - centos - 正文

君子好学,自强不息!

RedHat/CentOS 手动挂载磁盘

2023-02-26 | centos | admin | 6201°c
A+ A-

#创建挂载目录
mkdir /mnt/sda
mkdir /mnt/sdb
mkdir /mnt/sdc
mkdir /mnt/sdd
mkdir /mnt/sde
mkdir /mnt/sdf
mkdir /mnt/sdg
mkdir /mnt/sdh
mkdir /mnt/sdi
mkdir /mnt/sdj
#检查创建的挂载目录
ll /mnt/|awk ‘{print $9}’
#大于2T的磁盘需要使用parted命令来分区,格式化(创建文件系统),挂载到相应的挂载目录
parted -s /dev/sda mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sda
mount /dev/sda /mnt/sda

parted -s /dev/sdb mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdb
mount /dev/sdb /mnt/sdb

parted -s /dev/sdc mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdc
mount /dev/sdc /mnt/sdc

parted -s /dev/sdd mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdd
mount /dev/sdd /mnt/sdd

parted -s /dev/sde mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sde
mount /dev/sde /mnt/sde

parted -s /dev/sdf mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdf
mount /dev/sdf /mnt/sdf

parted -s /dev/sdg mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdg
mount /dev/sdg /mnt/sdg

parted -s /dev/sdh mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdh
mount /dev/sdh /mnt/sdh

parted -s /dev/sdi mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdi
mount /dev/sdi /mnt/sdi

parted -s /dev/sdj mklabel gpt mkpart primary 0% 100%
mkfs.xfs -f -n ftype=1 /dev/sdj
mount /dev/sdj /mnt/sdj

df -h
blkid /dev/sda
blkid /dev/sdb
blkid /dev/sdc
blkid /dev/sdd
blkid /dev/sde
blkid /dev/sdf
blkid /dev/sdg
blkid /dev/sdh
blkid /dev/sdi
blkid /dev/sdj

sh getblkid.sh |awk ‘{print $1,$2}’|sed ‘s/\”//g’|sed ‘s/\://g’
========================================================
[root@localhost mnt]# parted /dev/sdb
GNU Parted 3.1
使用 /dev/sdb
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) mklabel gpt
警告: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do you want to continue?
是/Yes/否/No? Yes
(parted) mkpart primary 0% 100%
(parted) print
Model: SEAGATE ST2000NM0045 (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name 标志
1 1049kB 2000GB 2000GB primary

(parted) quit
信息: You may need to update /etc/fstab.

[root@localhost mnt]# mkfs.xfs -f -n ftype=1 /dev/sdb
meta-data=/dev/sdb isize=256 agcount=4, agsize=122094662 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=488378646, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=238466, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost mnt]# mount /dev/sdb /mnt/sdb
[root@localhost mnt]# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/rhel-root 315G 4.6G 311G 2% /
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 84K 63G 1% /dev/shm
tmpfs 63G 9.4M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/sdi1 1016M 166M 850M 17% /boot
/dev/mapper/rhel-var_log 200G 97M 200G 1% /var/log
/dev/mapper/rhel-var_lib_docker 200G 33M 200G 1% /var/lib/docker
/dev/mapper/rhel-home 300G 38M 300G 1% /home
tmpfs 13G 16K 13G 1% /run/user/42
tmpfs 13G 0 13G 0% /run/user/0
/dev/sda 1.9T 33M 1.9T 1% /mnt/sda
/dev/sdb 1.9T 33M 1.9T 1% /mnt/sdb
————————————————————————–
lsblk

UUID=cf0500ff-d966-41f7-9a78-3d6cf2b1747e /mnt/sda xfs defaults 0 0
UUID=9375d000-39d3-4d2b-a4fc-b9ee8cb4c917 /mnt/sdb xfs defaults 0 0
UUID=821173ce-3197-4dd4-beaa-8c9b33814526 /mnt/sdc xfs defaults 0 0
UUID=69542dfb-3bd5-4292-a386-bd6ac52f3a57 /mnt/sdd xfs defaults 0 0
UUID=138a0eb5-0300-44e9-873a-f06d98754d17 /mnt/sde xfs defaults 0 0
UUID=54aea1ce-9b95-4048-b619-420350b464e0 /mnt/sdf xfs defaults 0 0
UUID=20eae6f1-5b28-4764-b9ee-2ad3518d420f /mnt/sdg xfs defaults 0 0
UUID=108147c3-fa8a-4e76-b028-1c2d7c886e81 /mnt/sdh xfs defaults 0 0

date -s “2018-05-10 18:12:00” &&hwclock –systohc ##更改系统时间
hwclock -w

date -s “2018-06-25 15:17:20” &&hwclock –systohc
===========================================================================
umount /var/lib/docker/
mkfs.xfs -f -n ftype=1 /dev/mapper/rhel-var_lib_docker
mount /dev/mapper/rhel-var_lib_docker /var/lib/docker/

本文来源:1818IP

本文地址:https://www.1818ip.com/post/32878.html

免责声明:本文由用户上传,如有侵权请联系删除!

发表评论

必填

选填

选填

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。