linux中查看文件和目錄的命令是:LS
創(chuàng)新互聯(lián)是一家從事企業(yè)網(wǎng)站建設(shè)、網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)、行業(yè)門戶網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)制作的專業(yè)網(wǎng)站制作公司,擁有經(jīng)驗(yàn)豐富的網(wǎng)站建設(shè)工程師和網(wǎng)頁設(shè)計(jì)人員,具備各種規(guī)模與類型網(wǎng)站建設(shè)的實(shí)力,在網(wǎng)站建設(shè)領(lǐng)域樹立了自己獨(dú)特的設(shè)計(jì)風(fēng)格。自公司成立以來曾獨(dú)立設(shè)計(jì)制作的站點(diǎn)1000多家。
LS英文原意:list,命令所在路徑:/bin/ls,適用于所有用戶權(quán)限,主要功能就是以列表形式顯示目錄文件。
其語法: ls 選項(xiàng)【-ald】【文件或目錄】
其中,-a 顯示所有文件,包括隱藏文件;
-l 詳細(xì)信息顯示;
-d 僅顯示目錄名,而不顯示目錄下的內(nèi)容列表;
-h 人性化顯示(hommization);
-i 查看任意一個(gè)文件的i節(jié)點(diǎn)(類似于身份證唯一信息);
-t 用文件和目錄的更改時(shí)間排序;可以用第一個(gè)顯示的文件判斷最近修改的文件;
注意:. 開頭的文件除非是目錄,否則就是隱藏文件
擴(kuò)展資料:
創(chuàng)建目錄命令:mkdir,英文原意:make directories,命令所在路徑:/bin/mkdir,適用于所有用戶權(quán)限,功能在于創(chuàng)建新的目錄。
其語法: mkdir 【-p】【目錄名】
-p 遞歸創(chuàng)建
例子:a)創(chuàng)建單個(gè)目錄:mkdir /tmp/vae.txt
b)創(chuàng)建多個(gè)目錄:mkdir /tmp/a.txt /tmp/b.txt
使用時(shí)的注意事項(xiàng):
1、創(chuàng)建的目錄已經(jīng)存在, 那么 Linux 會(huì)提示我們 Linux 無法創(chuàng)建它。
2、不帶任何參數(shù)運(yùn)行 mkdir 命令會(huì)在當(dāng)前目錄下創(chuàng)建目錄。
3、不帶上-p,如果新建的文件上級(jí)目錄不存在則不會(huì)執(zhí)行成功這種說法是錯(cuò)誤的。加或者不加上 -p 前面的目錄沒有得都會(huì)依次創(chuàng)建。
4、創(chuàng)建目錄的首要條件是, 在想要?jiǎng)?chuàng)建目錄的目標(biāo)路徑下你必須具有訪問權(quán)限。
一、多路徑解釋
多路徑,顧名思義就是有多種選擇的路徑。在SAN或IPSAN環(huán)境,主機(jī)和存儲(chǔ)之間外加了光纖交換機(jī),這就導(dǎo)致主機(jī)和存儲(chǔ)之間交換速度和效率增強(qiáng),一條路徑肯定是不行的,也是不安全不穩(wěn)定的。多路徑就是要來解決從主機(jī)到磁盤之間最快,最高效的問題。主要實(shí)現(xiàn)如下幾個(gè)功能
故障的切換和恢復(fù)
IO流量的負(fù)載均衡
磁盤的虛擬化
多路徑之前一直是存儲(chǔ)廠商負(fù)責(zé)解決,竟來被拆分出來單獨(dú)賣錢了。
構(gòu)架基本是這樣的:存儲(chǔ),多路徑軟件,光纖交換機(jī),主機(jī),主機(jī)系統(tǒng)。
二、LINUX下的multipath
1、查看是否自帶安裝?
1
2
3
4
5
6
[root@web2 multipath]# rpm -qa|grep device
device-mapper-1.02.39-1.el5
device-mapper-1.02.39-1.el5
device-mapper-multipath-0.4.7-34.el5
device-mapper-event-1.02.39-1.el5
[root@web2 multipath]#
2、安裝
1
2
3
4
5
6
rpm -ivh device-mapper-1.02.39-1.el5.rpm #安裝映射包
rpm -ivh device-mapper-multipath-0.4.7-34.el5.rpm #安裝多路徑包
外加加入開機(jī)啟動(dòng)
chkconfig –level 2345 multipathd on #設(shè)置成開機(jī)自啟動(dòng)multipathd
lsmod |grep dm_multipath #來檢查安裝是否正常
3、配置
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# on the default devices.
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|sr|scd|st)[0-9]*"
devnode "^hd[a-z]"
}
devices {
device {
vendor "HP"
path_grouping_policy multibus
features "1 queue_if_no_path"
path_checker readsector()
failback immediate
}
}brbr完整的配置如下:
blacklist {
devnode "^sda"
}
defaults {
user_friendly_names no
}
multipaths {
multipath {
wwid 14945540000000000a67854c6270b4359c66c272e2f356321
alias iscsi-dm0
path_grouping_policy multibus
path_checker tur
path_selector "round-robin 0"
}
multipath {
wwid 14945540000000000dcca2eda91d70b81edbcfce2357f99ee
alias iscsi-dm1
path_grouping_policy multibus
path_checker tur
path_selector "round-robin 0"
}
multipath {
wwid 1494554000000000020f763489c165561101813333957ed96
alias iscsi-dm2
path_grouping_policy multibus
path_checker tur
path_selector "round-robin 0"
}
multipath {
wwid 14945540000000000919ca813020a195422ba3663e1f03cc3
alias iscsi-dm3
path_grouping_policy multibus
path_checker tur
path_selector "round-robin 0"
}
}
devices {
device {
vendor "iSCSI-Enterprise"
product "Virtual disk"
path_grouping_policy multibus
getuid_callout "/sbin/scsi_id -g -u -s /block/%n"
path_checker readsector0
path_selector "round-robin 0"
}
}
4、命令
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
[root@web2 ~]# multipath -h
multipath-tools v0.4.7 (03/12, 2006)
Usage: multipath [-v level] [-d] [-h|-l|-ll|-f|-F|-r]
[-p failover|multibus|group_by_serial|group_by_prio]
[device]
-v level verbosity level
0 no output
1 print created devmap names only
2 default verbosity
3 print debug information
-h print this usage text
-b file bindings file location
-d dry run, do not create or update devmaps
-l show multipath topology (sysfs and DM info)
-ll show multipath topology (maximum info)
-f flush a multipath device map
-F flush all multipath device maps
-r force devmap reload
-p policy force all maps to specified policy :
failover 1 path per priority group
multibus all paths in 1 priority group
group_by_serial 1 priority group per serial
group_by_prio 1 priority group per priority lvl
group_by_node_name 1 priority group per target node
device limit scope to the device's multipath
(udev-style $DEVNAME reference, eg /dev/sdb
or major:minor or a device map name)
[root@web2 ~]#
5、啟動(dòng)關(guān)閉
1
2
3
4
# /etc/init.d/multipathd start #開啟mulitipath服務(wù)
service multipath start
service multipath restart
service multipath shutdown
6、如何獲取wwid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
1、
[root@vxfs01 ~]# cat /var/lib/multipath/bindings
# Multipath bindings, Version : 1.0
# NOTE: this file is automatically maintained by the multipath program.
# You should not need to edit this file in normal circumstances.
#
# Format:
# alias wwid
#
mpath0 36006016051d50e0035744871c912de11
mpath1 36006016051d50e0034744871c912de11
mpath2 36006016051d50e0032744871c912de11
mpath3 36006016051d50e0039744871c912de11
mpath4 36006016051d50e003a744871c912de11
2、
[root@vxfs01 ~]# multipath -v3 |grep 3600
sdb: uid = 36006016051d50e003a744871c912de11 (callout)
sdc: uid = 36006016051d50e003a744871c912de11 (callout)
sdd: uid = 36006016051d50e003a744871c912de11 (callout)
sde: uid = 36006016051d50e003a744871c912de11 (callout)
36006016051d50e003a744871c912de11 1:0:0:0 sdb 8:16 0 [undef][ready] DGC,RAI
36006016051d50e003a744871c912de11 1:0:1:0 sdc 8:32 1 [undef][ready] DGC,RAI
36006016051d50e003a744871c912de11 2:0:0:0 sdd 8:48 1 [undef][ready] DGC,RAI
36006016051d50e003a744871c912de11 2:0:1:0 sde 8:64 0 [undef][ready] DGC,RAI
Found matching wwid [36006016051d50e003a744871c912de11] in bindings file.
比較詳細(xì)的文字:
RHEL官網(wǎng)資料:
Linux多路徑指的是除了主機(jī)和硬盤一條路徑的連接,還包括了主機(jī)和網(wǎng)絡(luò)服務(wù)器的連接形成的主機(jī)一對多的路徑連接關(guān)系。通過多路徑的連接,實(shí)現(xiàn)了磁盤的虛擬化。
1、安裝多路徑軟件包:
device-mapper-1.02.67-2.el5
device-mapper-event-1.02.67.2.el5
device-mapper-multipath-0.4.7-48.el5
[root@RKDB01 Server]# rpm -ivh device-mapper-1.02.67-2.el5.x86_64.rpm
warning: device-mapper-1.02.67-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing.。。 ########################################### [100%]
package device-mapper-1.02.67-2.el5.x86_64 is already installed
[root@RKDB01 Server]# rpm -ivh device-mapper-event-1.02.67-2.el5.x86_64.rpm
warning: device-mapper-event-1.02.67-2.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing.。。 ########################################### [100%]
package device-mapper-event-1.02.67-2.el5.x86_64 is already installed
[root@RKDB01 Server]# rpm -ivh device-mapper-multipath-0.4.7-48.el5.x86_64.rpm
warning: device-mapper-multipath-0.4.7-48.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing.。。 ########################################### [100%]
package device-mapper-multipath-0.4.7-48.el5.x86_64 is already installed
2、設(shè)置開機(jī)啟動(dòng),并檢查安裝包是否正常:
chkconfig --level 345 multipathd on
lsmod |grep dm_multipath
[root@RKDB01 Server]# chkconfig --level 345 multipathd on
[root@RKDB01 Server]# lsmod |grep dm_multipath
dm_multipath 58969 0
scsi_dh 42561 1 dm_multipath
dm_mod 102417 4 dm_mirror,dm_multipath,dm_raid45,dm_log
[root@RKDB01 Server]#
3、配置multipathd 使其正常工作,編輯/etc/multipath.conf,開放如下內(nèi)容:
defaults {
udev_dir /dev
polling_interval 10
selector “round-robin 0”
path_grouping_policy multibus
getuid_callout “/sbin/scsi_id -g -u -s /block/%n”
prio_callout none
path_checker readsector0
rr_min_io 100
max_fds 8192
rr_weight priorities
failback immediate
no_path_retry fail
user_friendly_names yes
}
blacklist {
wwid 26353900f02796769
devnode “^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*”
devnode “^hd[a-z]”
}
4、并關(guān)閉如下內(nèi)容
#blacklist {
# devnode “*”
#}
#defaults {
27 # user_friendly_names yes
28 #}
5、完成之后執(zhí)行如下命令發(fā)現(xiàn)多路徑:
[root@RKDB01 Server]# modprobe dm-multipath
[root@RKDB01 Server]# multipath -F
[root@RKDB01 Server]# multipath dm-multipath
[root@RKDB01 Server]# multipath dm-round-robin
[root@RKDB01 Server]# service multipathd restart
正在關(guān)閉multipathd 端口監(jiān)控程序: [確定]
正在啟動(dòng)守護(hù)進(jìn)程multipathd: [確定]
[root@RKDB01 Server]# multipath -v2
[root@RKDB01 Server]# multipath -v2
[root@RKDB01 Server]# multipath -ll
mpath1 (3600d02310000011b16a5d57c6a1bd99a) dm-0 TOYOU,NetStor_iSUM510
[size=3.3T][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=2][ena bled]
\_ 1:0:0:0 sdb 8:16 [failed][ready]
\_ 1:0:1:0 sdc 8:32 [failed][ready]
[root@RKDB01 Server]#
6、重啟服務(wù)器后,可以看到多路徑信息了:
[root@RKDB01 ~]# ll /dev/mapper/
總計(jì) 0
crw------- 1 root root 10, 60 11-05 22:35 control
brw-rw---- 1 root disk 253, 0 11-05 22:35 mpath1
brw-rw---- 1 root disk 253, 1 11-05 22:35 mpath2
[root@RKDB01 ~]# multipath -ll
mpath2 (3600d02310000011b76128b9c63138cf4) dm-1 TOYOU,NetStor_iSUM510
[size=3.2T][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
\_ 1:0:0:1 sdc 8:32 [active][ready]
\_ 1:0:1:1 sde 8:64 [active][ready]
mpath1 (3600d02310000011b16a5d57c6a1bd99a) dm-0 TOYOU,NetStor_iSUM510
[size=20G][features=0][hwhandler=0][rw]
\_ round-robin 0 [prio=2][active]
\_ 1:0:0:0 sdb 8:16 [active][ready]
\_ 1:0:1:0 sdd 8:48 [active][ready]
7、通過fdisk 看可以生成了DM-0/DM-1兩個(gè)盤,正是上面sdc/sde,sdb/sdd多路徑后出來的:
[root@RKDB01 ~]# fdisk -l
Disk /dev/sda: 299.4 GB, 299439751168 bytes
255 heads, 63 sectors/track, 36404 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 38 305203+ 83 Linux
/dev/sda2 39 13092 104856255 83 Linux
/dev/sda3 13093 19619 52428127+ 83 Linux
/dev/sda4 19620 36404 134825512+ 5 Extended
/dev/sda5 19620 26146 52428096 83 Linux
/dev/sda6 26147 28757 20972826 83 Linux
/dev/sda7 28758 30324 12586896 82 Linux swap / Solaris
/dev/sda8 30325 36404 48837568+ 83 Linux
Disk /dev/sdb: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn‘t contain a valid partition table
Disk /dev/sdc: 3568.4 GB, 3568429957120 bytes
255 heads, 63 sectors/track, 433836 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdc doesn’t contain a valid partition table
Disk /dev/sdd: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdd doesn‘t contain a valid partition table
Disk /dev/sde: 3568.4 GB, 3568429957120 bytes
255 heads, 63 sectors/track, 433836 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sde doesn’t contain a valid partition table
Disk /dev/dm-0: 21.4 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-0 doesn‘t contain a valid partition table
Disk /dev/dm-1: 3568.4 GB, 3568429957120 bytes
255 heads, 63 sectors/track, 433836 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/dm-1 doesn’t contain a valid partition table
Disk /dev/sdf: 4009 MB, 4009754624 bytes
255 heads, 63 sectors/track, 487 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdf4 * 1 488 3915744+ b W95 FAT32
Partition 4 has different physical/logical endings:
phys=(486, 254, 63) logical=(487, 125, 22)
[root@RKDB01 ~]#
8、同時(shí)也可以在/dev/mapper目錄中查看到多路徑映射的信息:
[root@RKDB01 ~]# ll /dev/mapper/
總計(jì) 0
crw------- 1 root root 10, 60 11-06 00:49 control
brw-rw---- 1 root disk 253, 2 11-06 00:49 data-data001
brw-rw---- 1 root disk 253, 0 11-06 00:49 mpath1
brw-rw---- 1 root disk 253, 1 11-06 00:49 mpath2
分享名稱:linux查看多路徑命令 linux 查看當(dāng)前路徑大小
地址分享:http://jinyejixie.com/article46/ddojoeg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、網(wǎng)站排名、軟件開發(fā)、微信公眾號(hào)、動(dòng)態(tài)網(wǎng)站、企業(yè)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)