掛載壓縮的 tar 檔案並更新它

掛載壓縮的 tar 檔案並更新它

如何裝載 .tar.gz 檔案、更新它(新增檔案、編輯檔案),然後卸載它以使變更反映在原始壓縮檔案中?

如果沒有工具可以對 gzip 壓縮的 tar 檔案執行此操作,我願意接受其他壓縮格式。

我嘗試過 archivemount,但這會以唯讀模式掛載 .tar.gz 檔案。

答案1

預設archivemount工作在讀寫模式下,可能掛載的 tar.gz 檔案的權限不允許使用者更新它。

將“-o debug”新增至安裝選項可以幫助了解發生的情況。

答案2

它在 Fedora 20 1上對我來說工作得很好上對我來說工作得很好,也許你有一個錯誤,或者作為姆普羅莫內特建議,存檔是唯讀的:

[root@f20 ~]# tar czf /tmp/ul137194.tar.gz -C / /etc/passwd /etc/group /etc/shells
tar: Removing leading `/' from member names
[root@f20 ~]# mkdir /tmp/ul137194
[root@f20 ~]# archivemount /tmp/ul137194.tar.gz /tmp/ul137194
[root@f20 ~]# find /tmp/ul137194
/tmp/ul137194
/tmp/ul137194/etc
/tmp/ul137194/etc/passwd
/tmp/ul137194/etc/group
/tmp/ul137194/etc/shells
[root@f20 ~]# rm /tmp/ul137194/etc/shells
rm: remove regular file ‘/tmp/ul137194/etc/shells’? y
[root@f20 ~]# echo nogroups > /tmp/ul137194/etc/group
[root@f20 ~]# umount /tmp/ul137194
[root@f20 ~]# tar xzf /tmp/ul137194.tar.gz -C /tmp/ul137194
[root@f20 ~]# find /tmp/ul137194
/tmp/ul137194
/tmp/ul137194/etc
/tmp/ul137194/etc/group
/tmp/ul137194/etc/passwd
[root@f20 ~]# cat /tmp/ul137194/etc/group
nogroups

1 archivemount-0.8.1-2.fc20.x86_64、libarchive-3.1.2-7.fc20.x86_64、fuse-2.9.3-2.fc20.x86_64

相關內容