Linux挂载文件的权限

Linux挂载文件的权限,第1张

在Linux中也可以读取Windows分区,包括fat32格式的和ntfs格式的。让Linux系统启动时有自动挂载windows分区权限,可以命令写入 /etc/fstab 文件中,下面是一个例子:

/dev/disk/by-id/ata-HITACHI_HTS723225L9SA61_FDE_090521FC1D20NJG943JG-part1 /windows/C           ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

/dev/disk/by-id/ata-HITACHI_HTS723225L9SA61_FDE_090521FC1D20NJG943JG-part5 /windows/D           ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

#/dev/disk/by-id/ata-HITACHI_HTS723225L9SA61_FDE_090521FC1D20NJG943JG-part6 /windows/E           ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

/dev/disk/by-id/ata-HITACHI_HTS723225L9SA61_FDE_090521FC1D20NJG943JG-part6 /windows/E           ntfs-3g    users,gid=users,fmask=0,dmask=0,locale=en_US.UTF-8 0 0

/dev/disk/by-id/ata-HITACHI_HTS723225L9SA61_FDE_090521FC1D20NJG943JG-part7 /windows/F           ntfs-3g    users,gid=users,fmask=133,dmask=022,locale=en_US.UTF-8 0 0

默认挂载是 root 拥有读写权限,当没有执行权限,其它用户只有可读权限。

如上代码挂载文件权限设置解释如下:

#dmask是目录的mask,fmask是文件的mask

#mask是权限掩码,由3个八进制的数字所组成,

#当前访问权限去掉权限掩码所表示的权限之后,

#即可产生建立文件时预设的权限。

#第一位表示自己访问的权限

#第二位表示同组访问的权限

#第三位表示其他所有人访问的权限

#每位表示为二进制,又可以有三位,分别表示读、写和可执行。

#例如-r-----r-x表示文件

#自己可以读,不能写,不能执行

#同组人不能读,不能写,不能执行

#其他人可以读,不能写,可以执行

#因为挂载的是windows的盘符,是ntfs分区,

#linux为了安全起见,分区只读,默认访问模式为555

#可以执行可以读但是不能写入,而且中间一位不能改动。

如果使用了 多路径方案, 可以直接使用multipath 绑定设备名 不需要用到 asmlib或UDEV

请直接参考 文档:Configuring non-raw multipath devices for Oracle Clusterware 11g (11.1.0, 11.2.0) on RHEL5/OL5 [ID 605828.1]

[root@vrh1 ~]# for i in `cat /proc/partitions | awk '{print $4}' |grep sd | grep [a-z]$`do echo "### $i: `scsi_id -g -u -s /block/$i`"done

### sda: SATA_VBOX_HARDDISK_VB83d4445f-b8790695_

### sdb: SATA_VBOX_HARDDISK_VB0db2f233-269850e0_

### sdc: SATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_

### sdd: SATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_

### sde: SATA_VBOX_HARDDISK_VB5a531910-25f4eb9a_

### sdf: SATA_VBOX_HARDDISK_VB4915e6e3-737b312e_

### sdg: SATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9_

### sdh: SATA_VBOX_HARDDISK_VBc0115ef6-a48bc15d_

### sdi: SATA_VBOX_HARDDISK_VB3a556907-2b72391d_

### sdj: SATA_VBOX_HARDDISK_VB7ec8476c-08641bd4_

### sdk: SATA_VBOX_HARDDISK_VB743e1567-d0009678_

[root@vrh1 ~]# grep -v ^# /etc/multipath.conf

defaults {

user_friendly_names yes

}

defaults {

udev_dir /dev

polling_interval 10

selector "round-robin 0"

path_grouping_policy failover

getuid_callout "/sbin/scsi_id -g -u -s /block/%n"

prio_callout /bin/true

path_checker readsector0

rr_min_io 100

rr_weight priorities

failback immediate

#no_path_retry fail

user_friendly_name yes

}

devnode_blacklist {

devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"

devnode "^hd[a-z]"

devnode "^cciss!c[0-9]d[0-9]*"

}

multipaths {

multipath {

wwidSATA_VBOX_HARDDISK_VB0db2f233-269850e0_

alias voting1

path_grouping_policy failover

}

multipath {

wwidSATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_

alias voting2

path_grouping_policy failover

}

multipath {

wwidSATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_

alias voting3

path_grouping_policy failover

}

multipath {

wwidSATA_VBOX_HARDDISK_VB5a531910-25f4eb9a_

alias ocr1

path_grouping_policy failover

}

multipath {

wwidSATA_VBOX_HARDDISK_VB4915e6e3-737b312e_

alias ocr2

path_grouping_policy failover

}

multipath {

wwidSATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9_

alias ocr3

path_grouping_policy failover

}

}

[root@vrh1 ~]# multipath

[root@vrh1 ~]# multipath -ll

mpath2 (SATA_VBOX_HARDDISK_VB3a556907-2b72391d_) dm-9 ATA,VBOX HARDDISK

size=5.0G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 8:0:0:0 sdi 8:128 active ready running

mpath1 (SATA_VBOX_HARDDISK_VBc0115ef6-a48bc15d_) dm-8 ATA,VBOX HARDDISK

size=5.0G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 7:0:0:0 sdh 8:112 active ready running

ocr3 (SATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9_) dm-7 ATA,VBOX HARDDISK

size=5.0G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 6:0:0:0 sdg 8:96 active ready running

ocr2 (SATA_VBOX_HARDDISK_VB4915e6e3-737b312e_) dm-6 ATA,VBOX HARDDISK

size=5.0G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 5:0:0:0 sdf 8:80 active ready running

ocr1 (SATA_VBOX_HARDDISK_VB5a531910-25f4eb9a_) dm-5 ATA,VBOX HARDDISK

size=5.0G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 4:0:0:0 sde 8:64 active ready running

voting3 (SATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_) dm-4 ATA,VBOX HARDDISK

size=40G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 3:0:0:0 sdd 8:48 active ready running

voting2 (SATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_) dm-3 ATA,VBOX HARDDISK

size=40G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 2:0:0:0 sdc 8:32 active ready running

voting1 (SATA_VBOX_HARDDISK_VB0db2f233-269850e0_) dm-2 ATA,VBOX HARDDISK

size=40G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 1:0:0:0 sdb 8:16 active ready running

mpath4 (SATA_VBOX_HARDDISK_VB743e1567-d0009678_) dm-11 ATA,VBOX HARDDISK

size=5.0G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 10:0:0:0 sdk 8:160 active ready running

mpath3 (SATA_VBOX_HARDDISK_VB7ec8476c-08641bd4_) dm-10 ATA,VBOX HARDDISK

size=5.0G features='0' hwhandler='0' wp=rw

`-+- policy='round-robin 0' prio=1 status=active

`- 9:0:0:0 sdj 8:144 active ready running

[root@vrh1 ~]# dmsetup ls | sort

mpath1 (253, 8)

mpath2 (253, 9)

mpath3 (253, 10)

mpath4 (253, 11)

ocr1(253, 5)

ocr2(253, 6)

ocr3(253, 7)

VolGroup00-LogVol00 (253, 0)

VolGroup00-LogVol01 (253, 1)

voting1 (253, 2)

voting2 (253, 3)

voting3 (253, 4)

[root@vrh1 ~]# ls -l /dev/mapper/*

crw------- 1 root root 10, 62 Oct 17 09:58 /dev/mapper/control

brw-rw---- 1 root disk 253, 8 Oct 19 00:11 /dev/mapper/mpath1

brw-rw---- 1 root disk 253, 9 Oct 19 00:11 /dev/mapper/mpath2

brw-rw---- 1 root disk 253, 10 Oct 19 00:11 /dev/mapper/mpath3

brw-rw---- 1 root disk 253, 11 Oct 19 00:11 /dev/mapper/mpath4

brw-rw---- 1 root disk 253, 5 Oct 19 00:11 /dev/mapper/ocr1

brw-rw---- 1 root disk 253, 6 Oct 19 00:11 /dev/mapper/ocr2

brw-rw---- 1 root disk 253, 7 Oct 19 00:11 /dev/mapper/ocr3

brw-rw---- 1 root disk 253, 0 Oct 17 09:58 /dev/mapper/VolGroup00-LogVol00

brw-rw---- 1 root disk 253, 1 Oct 17 09:58 /dev/mapper/VolGroup00-LogVol01

brw-rw---- 1 root disk 253, 2 Oct 19 00:11 /dev/mapper/voting1

brw-rw---- 1 root disk 253, 3 Oct 19 00:11 /dev/mapper/voting2

brw-rw---- 1 root disk 253, 4 Oct 19 00:11 /dev/mapper/voting3

[root@vrh1 ~]# ls -l /dev/dm*

brw-rw---- 1 root root 253, 0 Oct 17 09:58 /dev/dm-0

brw-rw---- 1 root root 253, 1 Oct 17 09:58 /dev/dm-1

brw-rw---- 1 root root 253, 10 Oct 19 00:11 /dev/dm-10

brw-rw---- 1 root root 253, 11 Oct 19 00:11 /dev/dm-11

brw-rw---- 1 root root 253, 2 Oct 19 00:11 /dev/dm-2

brw-rw---- 1 root root 253, 3 Oct 19 00:11 /dev/dm-3

brw-rw---- 1 root root 253, 4 Oct 19 00:11 /dev/dm-4

brw-rw---- 1 root root 253, 5 Oct 19 00:11 /dev/dm-5

brw-rw---- 1 root root 253, 6 Oct 19 00:11 /dev/dm-6

brw-rw---- 1 root root 253, 7 Oct 19 00:11 /dev/dm-7

brw-rw---- 1 root root 253, 8 Oct 19 00:11 /dev/dm-8

brw-rw---- 1 root root 253, 9 Oct 19 00:11 /dev/dm-9

[root@vrh1 ~]# ls -l /dev/disk/by-id/

total 0

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB0db2f233-269850e0 ->../../asm-diskb

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB3a556907-2b72391d ->../../asm-diski

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB4915e6e3-737b312e ->../../asm-diskf

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB512c8f75-37f4a0e9 ->../../asm-diskg

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB5a531910-25f4eb9a ->../../asm-diske

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB743e1567-d0009678 ->../../asm-diskk

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB7ec8476c-08641bd4 ->../../asm-diskj

lrwxrwxrwx 1 root root 9 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB83d4445f-b8790695 ->../../sda

lrwxrwxrwx 1 root root 10 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB83d4445f-b8790695-part1 ->../../sda1

lrwxrwxrwx 1 root root 10 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VB83d4445f-b8790695-part2 ->../../sda2

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VBa56f2571-0dd27b33 ->../../asm-diskc

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VBc0115ef6-a48bc15d ->../../asm-diskh

lrwxrwxrwx 1 root root 15 Oct 17 09:58 scsi-SATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8 ->../../asm-diskd

Report Abuse Like (0)

2. Re: asm磁盘使用链路聚合设备名,IO性能只有非聚合设备的1/6!

LiuMaclean(刘相兵)

Expert

LiuMaclean(刘相兵) Jul 21, 2013 11:09 AM (in response to 13628)

step 1:

[oracle@vrh8 mapper]$ cat /etc/multipath.conf

multipaths {

multipath {

wwidSATA_VBOX_HARDDISK_VBf6b74ff7-871d1de8_

alias asm-disk1

mode 660

uid 501

gid 503

}

multipath {

wwidSATA_VBOX_HARDDISK_VB0db2f233-269850e0_

alias asm-disk2

mode 660

uid 501

gid 503

}

multipath {

wwid SATA_VBOX_HARDDISK_VBa56f2571-0dd27b33_

alias asm-disk3

mode 660

uid 501

gid 503

}

}

第二步:

reboot or service multipathd restart

第三步:

[oracle@vrh8 mapper]$ ls -l /dev/mapper/asm-disk*

brw-rw---- 1 grid asmadmin 253, 4 Jul 21 07:02 /dev/mapper/asm-disk1

brw-rw---- 1 grid asmadmin 253, 2 Jul 21 07:02 /dev/mapper/asm-disk2

brw-rw---- 1 grid asmadmin 253, 3 Jul 21 07:02 /dev/mapper/asm-disk3


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7544383.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-06
下一篇 2023-04-06

发表评论

登录后才能评论

评论列表(0条)

保存