[Linux] ext2, ext3, ext4, xfs 檔案系統中,檔案路徑的最長長度?
今天在看 Linux 上檔案系統允許的最長路徑,確保我們的產品被裝到其他目錄裡沒有問題…
查了一下 wikipedia: Comparison of file systems,
以 Linux 常見的 ext2, ext3, ext4, 和 xfs 來說,
路徑中單一檔案/目錄的長度不能超過 255 (NAME_MAX),但整體的長度是沒有限制的~
舉例來說,不能建立 /tmp/(256個 A) 這種目錄:
testuser@localhost /tmp $ mkdir $(python -c "print 'A'*256") mkdir: cannot create directory ‘AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA’: File name too long
但 /tmp/(255 個 A)/(255 個 B)/(255 個 C)/… 這種是可以的:
testuser@localhost /tmp $ mkdir -p $(python -c "print '/'.join(['A'*255, 'B'*255, 'C'*255, 'D'*255, 'E'*255])")
進入這種目錄也沒有問題喔:
testuser@localhost /tmp $ cd A*/*/*/*/* testuser@localhost /tmp/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB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