- 磁盘识别
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 64G 64G 20K 100% /
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 63G 42M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/mapper/mpatha2 510M 128M 382M 26% /boot
/dev/mapper/mpatha1 192M 9.5M 183M 5% /boot/efi
tmpfs 13G 0 13G 0% /run/user/0
/dev/loop0 3.8G 3.8G 0 100% /mnt/cdrom
- 由于大部分数据放在/opt下,并没有/opt的挂载点,看下/opt是属于哪个挂载点
[root@localhost ~]# df /opt
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 66322800 66322780 20 100% /
- /挂载点的容量已经被用光了,加上新的磁盘,重启linux机器
- 查看磁盘是否被识别
[root@localhost ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 1600.3 GB, 1600321314816 bytes, 3125627568 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
# Start End Size Type Name
1 2048 3125626879 1.5T unknown
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sdb: 85.9 GB, 85899345920 bytes, 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 16384 bytes / 16777216 bytes
Disk label type: gpt
# Start End Size Type Name
1 32768 425983 192M EFI System EFI System Partition
2 425984 1474559 512M Microsoft basic
3 1474560 167739391 79.3G Linux LVM
fdisk: cannot open /dev/sdc: Input/output error
- 挂载磁盘
- 由
fdisk -l
命令可知,新加的磁盘名称为/dev/sda
- 在这里不进行分区,直接将整块磁盘格式化,挂载点为/data
- 格式化为xfs文件系统
[root@localhost ~]# mkfs.xfs -f /dev/sda
meta-data=/dev/sda isize=256 agcount=4, agsize=97675862 blks
= sectsz=4096 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=390703446, imaxpct=5
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal log bsize=4096 blocks=190773, version=2
= sectsz=4096 sunit=1 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
# 注意一定要有/data目录,没有就用mkdir创建一个,但是如果原来就有
# /data目录下的数据一定要备份,要不然会丢失
[root@localhost ~]# mount /dev/sda /data
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 64G 64G 20K 100% /
devtmpfs 63G 0 63G 0% /dev
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 63G 42M 63G 1% /run
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/mapper/mpatha2 510M 128M 382M 26% /boot
/dev/mapper/mpatha1 192M 9.5M 183M 5% /boot/efi
tmpfs 13G 0 13G 0% /run/user/0
/dev/loop0 3.8G 3.8G 0 100% /mnt/cdrom
/dev/sda 1.5T 33M 1.5T 1% /data
- 使挂载永久生效
[root@localhost ~]# vi /etc/fstab
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=179fcfbf-cd9a-4659-8f9c-573abba4971f /boot xfs defaults 0 0
UUID=39BB-EB15 /boot/efi vfat umask=0077,shortname=winnt 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
#添加下面这一行
/dev/sda /data xfs defaults 0 0
网友评论