搜尋此網誌

2020年7月21日 星期二

如何強制解除QNAP Nas檔案被鎖的問題(Unlocking Files On QNAP)

有時候word 、Excel...等等檔案放在QNAP Nas上,因為總總原因...可能是Client當機whatever檔案就是被lock,如果檔案在windows file server有介面可能強制unlock,但QNAP NAS呢?

有的參考schumaku網友的答覆,OK的。

以下是其回答的範例:

Run smbstatus from the NAS shell, and check fhe "Locked files" section, like:

[~] # /mnt/ext/opt/samba/bin/smbstatus

Samba version 4.4.9
PID Username Group Machine Protocol Version Encryption Signing
----------------------------------------------------------------------------------------------------------------------------------------
18606 <<snip>> everyone snip-n550j (192.168.1.2) SMB3_11 - partial(AES-128-CMAC)
18606 -1 -1 snip-n550j (192.168.1.2) SMB3_11 - -
...
Service pid Username Adderess Machine Connected at Encryption Signing
QNAP need start--------------------------------------
Public 18606 <<snip> 192.168.1.2 kurt-n550j Sat Apr 8 02:41:09 PM 2017 CEST - -
QNAP need end--------------------------------------

Locked files:
Pid Uid DenyMode Access R/W Oplock SharePath Name Time
--------------------------------------------------------------------------------------------------
18606 1001 DENY_NONE 0x100081 RDONLY NONE /share/CACHEDEV1_DATA/Public . Sat Apr 8 14:41:11 2017
18606 1001 DENY_NONE 0x100081 RDONLY NONE /share/CACHEDEV1_DATA/Public . Sat Apr 8 14:41:11 2017
18606 1001 DENY_WRITE 0x12019f RDWR LEASE(RWH) /share/CACHEDEV1_DATA/Public Microsoft Word Document (neu).docx Sat Apr 8 14:41:30 2017

Just unlock a single file is not possible - you might have to kill the related SAMBA process using the Pid listed, like

[~] # ps -ef | grep 18606
18606 admin 15972 S /usr/local/samba/sbin/smbd -l /var/log -D -s /etc/config/smb.conf

[~] # kill 18606