linux file lock
linux file lock
linuxµÄÎļþËø·ÖΪÁ½ÖÖ£º
Ò»ÖÖÊÇadvasory lock£¬Ö»Äܱ£Ö¤½ø³ÌÄÚ¶Ôͬһ¸öÎļþËøµÄ»¥³âÓÐЧ£¬µ«ÊǶà¸ö½ø³Ì¿ÉÒÔͬʱ¶ÔÒ»¸öÎļþ¼Ó»¥³âµÄËø£¬ËùÒÔÕâÖÖËøÊǼÓÔÚfile ½á¹¹ÉÏ;Ò»ÖÖÊÇmandatory lock£¬ÕâÖÖËø¿ÉÒÔ±£Ö¤¶à¸ö½ø³ÌÎÞ·¨¶Ôͬһ¸öÎļþ¶¼¼ÓÉÏ»¥³âËø£¬ËùÒÔÕâÖÖËøÊǼÓÔÚinode ½á¹¹Éϵġ£
µ±¼Ómandatroy lockʱ£¬Èç¹ûÒÑÓнø³ÌÔÚÎļþÉϼÓÁË»¥³âËøa£¬ÄÇô½ø³Ì´´½¨µÄfile_lock b½á¹¹½«»á¼ÓÈëµ½aµÄµÈ´ýÁ´±íÖУ¬´Ëʱa½Ð×öblocker£¬b±»³ÆΪwaiter¡£ÓÉÓÚ½ø³ÌÏëÒªµÄ×ÊÔ´£¨¼ÓËø£©ÎÞ·¨±»Âú×㣬ËùÒÔ½ø³ÌҪô±»×èÈû£¬½ø³ÌµÄÃèÊö·û±»¼ÓÈëµ½ bµÄµÈ´ýÁ´±íÖУ»ÒªÃ´ÏµÍ³µ÷ÓÃÖ±½Ó·µ»Ø´íÎó¡££¨È¡¾öÓÚµ÷ÓÃʱµÄflagÖµ£©
Ïà¹ØÎĵµ£º
·¶Àý£º
1¡¢pvs
¡¡¡¡[root@localhost yuanbor]# /sbin/pvs ¼ì²éÊÇ·ñÓÐÖØÃûµÄVG×é
¡¡¡¡2¡¢vgrename
¡¡¡¡[root@localhost yuanbor]#/sbin/vgrename [VG UUID] /dev/VolGroup01 #½«Öظ´µÄVG×é ¸ù¾ÝUUID¸ÄΪ VolGroup01
¡¡¡¡[root@localhost yuanbor]# /sbin/pvs #¼ì²é Ð޸Ľá¹û
¡¡¡ ......
1¡¢²é¿´½ø³Ì·þÎñÊý£¬ÀýÈ磺ps -u ats3|grep Commer|wc -l
ÆäÖГ-u”£¬ºóÃæ¸úÓû§£¬“|grep Commer|”ÊÇ¿´ats3Óû§ÏµÄCommer·þÎñÊý£¬“|wc -l”¿´ÐÐÊý£»
2¡¢°´Ê±¼äÅÅÐò²é¿´Îļþ£ºls -lrt£»
3¡¢viÖеÄÃüÁ
:set nu ÏÔʾÐÐÊý
°´x¼ü£ºÉ¾³ý¹â±ê´¦µÄÒ»¸ö×Ö·û
°´dd¼ü£ºÉ¾³ý¹â±êËùÔÚµÄÐÐ
......
×÷ΪLinuxϵijÌÐò¿ª·¢ÈËÔ±£¬´ó¼ÒÒ»¶¨¶¼Óöµ½¹ýMakefile£¬ÓÃmakeÃüÁîÀ´±àÒë×Ô¼ºÐ´µÄ³ÌÐòȷʵÊǺܷ½±ã¡£Ò»°ãÇé¿öÏ£¬´ó¼Ò¶¼ÊÇÊÖ¹¤Ð´Ò»¸ö¼òµ¥Makefile£¬Èç¹ûÒªÏëд³öÒ»¸ö·ûºÏ×ÔÓÉÈí¼þ¹ßÀýµÄMakefile¾Í²»ÄÇôÈÝÒ×ÁË¡£
¡¡¡¡ÔÚ±¾ÎÄÖУ¬½«¸ø´ó¼Ò½éÉÜÈçºÎʹÓÃautoconfºÍautomakeÁ½¸ö¹¤¾ßÀ´°ïÖúÎÒÃÇ×Ô¶¯µØÉú³É·ûºÏ×ÔÓÉÈí¼þ¹ßÀýµÄMa ......
1¡¢È¨Ï޵IJ鿴
ls -l ÎļþÃû³Æ
2¡¢È¨ÏÞÐÞ¸Ä
chmod abc file
ÆäÖÐa,b,c¸÷Ϊһ¸öÊý×Ö£¬·Ö±ð±íʾUser¡¢Group¡¢¼°OtherµÄȨÏÞ¡£
r=4£¬w=2£¬x=1£¬x±êʾִÐÐȨÏÞ¡£ÈôÒªrwxÊôÐÔÔò4+2+1=7£»ÈôÒ ......