Linux下多个盘符乱的问题处理

参考文档:
linux下man fstab命令查看帮助,有一段说明,可以使用UUID,或者LABEL= 来绑定盘。这里使用UUID来绑定 
Instead  of  giving the device explicitly, one may indicate the filesystem that is to be mounted by its UUID or
              LABEL  (cf.   e2label(8)  or  xfs_admin(8)),  writing  LABEL=

man mkfs.xfs 命令查看,设置label 
-L label
              Set the filesystem label.  XFS filesystem labels can be at most 12 characters long; if label is longer than  12
              characters,  mkfs.xfs  will  not  proceed with creating the filesystem.  Refer to the mount(8) and xfs_admin(8)
              manual entries for additional information.


-- 问题,在启动数据库的时候,报错,某一些文件或者目标不存在

SYS@test SQL> startup
ORA-01261: Parameter db_recovery_file_dest destination string cannot be translated
ORA-01262: Stat failed on a file destination directory
Linux-x86_64 Error: 2: No such file or directory
SYS@test SQL>

-- 查看了下/etc/fstab下面的盘,有sdb、sdc、sdd、sde四个盘。查看四个盘对应的挂载点,发现里面的文件乱了,原来是启动后盘符乱了

/dev/mapper/ol_19cdg01-root /                       xfs     defaults        0 0
UUID=357c1a07-7c12-48e6-a1b2-d9b7e2c608de /boot                   xfs     defaults        0 0
/dev/mapper/ol_19cdg01-swap swap                    swap    defaults        0 0

/dev/sdb1                /u01                       xfs     defaults        0 0
/dev/sdc1                /oradata                   xfs     defaults        0 0
/dev/sdd1                /arch                      xfs     defaults        0 0
/dev/sde1                /mysql                     xfs     defaults        0 0

-- 可以看到,两次启动后,盘符是不一样的。比如两次sdd盘的大小就不一样 

[root@19ctest mysql]# fdisk -l | grep sd
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    41943039    19921920   8e  Linux LVM
Disk /dev/sdb: 42.9 GB, 42949672960 bytes, 83886080 sectors
/dev/sdb1            2048    83886079    41942016   83  Linux
Disk /dev/sdc: 128.8 GB, 128849018880 bytes, 251658240 sectors
/dev/sdc1            2048   251658239   125828096   83  Linux
Disk /dev/sdd: 107.4 GB, 107374182400 bytes, 209715200 sectors
/dev/sdd1            2048   209715199   104856576   83  Linux
Disk /dev/sde: 128.8 GB, 128849018880 bytes, 251658240 sectors
/dev/sde1            2048   251658239   125828096   83  Linux
[root@19ctest mysql]#
[root@19ctest ~]# fdisk -l | grep sd
Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    41943039    19921920   8e  Linux LVM
Disk /dev/sdb: 42.9 GB, 42949672960 bytes, 83886080 sectors
/dev/sdb1            2048    83886079    41942016   83  Linux
Disk /dev/sdc: 128.8 GB, 128849018880 bytes, 251658240 sectors
/dev/sdc1            2048   251658239   125828096   83  Linux
Disk /dev/sdd: 128.8 GB, 128849018880 bytes, 251658240 sectors
/dev/sdd1            2048   251658239   125828096   83  Linux
Disk /dev/sde: 107.4 GB, 107374182400 bytes, 209715200 sectors
/dev/sde1            2048   209715199   104856576   83  Linux
[root@19ctest ~]#

-- 找到盘和挂载点的对应关系后,打算使用uuid在/etc/fstab中绑定

scsi_id -g -u -d /dev/sdb

sdb  -- /u01    36000c2960d16839a1c4cd1fc74bfd28b
sde  -- /mysql  36000c29cd2ab754f9d1f8d819b5ddf73
sdc  -- /oradata 36000c29a0c36c71b884a788f3e52ae3a
sdd  -- /arch   36000c29e5e90b68f2dbae8eba081503f

-- 修改/etc/fstab,绑定如下,但是mount的时候,报错,找不到UUID 

/dev/sdb1                /u01                       xfs     defaults        0 0
/dev/sdc1                /oradata                   xfs     defaults        0 0
/dev/sdd1                /arch                      xfs     defaults        0 0
/dev/sde1                /mysql                     xfs     defaults        0 0


uuid=36000c2960d16839a1c4cd1fc74bfd28b                /u01                       xfs     defaults        0 0
uuid=36000c29a0c36c71b884a788f3e52ae3a                /oradata                   xfs     defaults        0 0
uuid=36000c29e5e90b68f2dbae8eba081503f                /arch                      xfs     defaults        0 0
uuid=36000c29cd2ab754f9d1f8d819b5ddf73                /mysql                     xfs     defaults        0 0

[root@19ctest ~]# mount -a
mount: can't find UUID=36000c2960d16839a1c4cd1fc74bfd28b
mount: can't find UUID=36000c29a0c36c71b884a788f3e52ae3a
mount: can't find UUID=36000c29e5e90b68f2dbae8eba081503f
mount: can't find UUID=36000c29cd2ab754f9d1f8d819b5ddf73
[root@19ctest ~]#

-- 仔细查看/etc/fstab中的内容,发现UUID=357c1a07-7c12-48e6-a1b2-d9b7e2c608de 这个UUID,和SICI_ID出来的结果不一样,原来这个UUID是使用blkid命令得出的

[root@19ctest ~]# lsblk
NAME                MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdd                   8:48   0  120G  0 disk
└─sdd1                8:49   0  120G  0 part
sdb                   8:16   0   40G  0 disk
└─sdb1                8:17   0   40G  0 part
sr0                  11:0    1  4.5G  0 rom
sde                   8:64   0  100G  0 disk
└─sde1                8:65   0  100G  0 part
sdc                   8:32   0  120G  0 disk
└─sdc1                8:33   0  120G  0 part
sda                   8:0    0   20G  0 disk
├─sda2                8:2    0   19G  0 part
│ ├─ol_19cdg01-swap 252:1    0    2G  0 lvm  [SWAP]
│ └─ol_19cdg01-root 252:0    0   17G  0 lvm  /
└─sda1                8:1    0    1G  0 part /boot
[root@19ctest ~]# blkid /dev/sdd1
/dev/sdd1: UUID="7c8f7ccc-5ca5-4447-aeb4-edcc810fbfce" TYPE="xfs"
[root@19ctest ~]# blkid /dev/sdc1
/dev/sdc1: UUID="adb83729-7a67-4416-b4ad-97ec1d61b704" TYPE="xfs"
[root@19ctest ~]# blkid /dev/sdb1
/dev/sdb1: UUID="a716c33d-5e7c-422f-aa1e-7b09f1c5d568" TYPE="xfs"
[root@19ctest ~]# blkid /dev/sde1
/dev/sde1: UUID="dc153057-bd51-463a-84d1-90e5a38522d7" TYPE="xfs"
[root@19ctest ~]#
UUID=a716c33d-5e7c-422f-aa1e-7b09f1c5d568                /u01                       xfs     defaults        0 0
UUID=adb83729-7a67-4416-b4ad-97ec1d61b704                /oradata                   xfs     defaults        0 0
UUID=7c8f7ccc-5ca5-4447-aeb4-edcc810fbfce                /arch                      xfs     defaults        0 0
UUID=dc153057-bd51-463a-84d1-90e5a38522d7                /mysql                     xfs     defaults        0 0

-- 修改/etc/fstab,使用lsblk获取的uuid来绑定,问题解决。
END

你可能感兴趣的:(OS,linux)