Linux/AVFS
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
[[Linux]]
#contents
* FUSE [#u3980507]
** FUSEとは [#v66864a8]
FUSE - Filesystem in Userspace~
カーネル空間ではなく、ユーザ空間で仮想のファイルシステ...
FUSEはモジュールとしてカーネルに組み込んでおき、あとはF...
sshfsなんかもあるみたいですね。
#br
* AVFS [#b86b7f73]
FUSEを使った仮想ファイルシステムであるAVFSを導入してみ...
#br
** AVFSとは [#ja929ac3]
AVFS - A Virtual File System~
とある通り、linuxの仮想ファイルシステムで、圧縮ファイル...
圧縮ファイルを展開せずに、普段と変わることなくディレク...
DOSのファイラーで圧縮ファイルを仮想ディレクトリとして扱...
#br
** 介入行動の対象 [#qab6eba8]
どんなファイルに対応しているかは avfs のリリースページ...
- 対応ファイル
-- tar
-- gzip
-- bzip2
-- zip
-- ar
-- rar
- extfs で対応
-- cpio
-- rpm
-- lha
-- arj
-- dpkg
-- apt
-- zoo
-- 7z
--- 他にも ftp とか audio とかいろいろ
#br
** 必要ファイルの準備 [#ged2ac80]
AVFS導入のため、以下を用意します。
- fuse~
#ref(http://fuse.sourceforge.net/,FUSE);
- avfs~
#ref(http://avf.sourceforge.net/,AVFS);
kernel 2.6.10(14?) 以上であれば、カーネルコンフィグで C...
うちでは CONFIG_FUSE_FS not set にしていて、カーネルの...
** make [#kc90d77e]
- fuseのmake~
特に何も考えずそのままmake; make installします。
-- tar-ballを展開して
$ tar xzf fuse-2.7.4.tar.gz
$ cd fuse-2.7.4/
-- confiture 〜 make install まで実施
$ ./configure
$ make
$ su
# make install
-- ldconfig実施
# vi /etc/ld.so.conf
/usr/local/lib ★libfuse.soはここに入るので、ld.so.confに...
# ldconfig
- avfsのmake~
-- tar-ballを展開して
$ tar xjf avfs-0.9.8.tar.bz2
$ avfs-0.9.8
-- ''--enable-fuse'' 付きでconfigure
$ ./configure --enable-fuse
:
:
checking whether fuse is new enough... no
:
Building library : yes
Building avfsd for fuse : no ★
:
何ぞ...~
avfsdがmake対象にならないのでconfigure眺めて行ったら
25046 pkg-config --atleast-version=2.6.0 fuse >/de...
ここでfuseのテストフラグが失敗になってるっぽいので、con...
-- ''--disable-fuse-test'' も付けてconfigure
$ ./configure --enable-fuse --disable-fuse-test
:
:
checking whether fuse is new enough... yes
:
Building library : yes
Building avfsd for fuse : yes ★
:
となってくれればOKです。
-- make; make install
$ make
$ su
# make install
bindir等をいじらなければ、以下に主なバイナリとスクリプ...
$ ls -l /usr/bin/*avfs*
-rwxr-xr-x 1 root root 1239 11月 7 07:35 /usr/bin/avf...
-rwxr-xr-x 1 root root 784848 11月 7 07:35 /usr/bin/avfsd
-rwxr-xr-x 1 root root 466 11月 7 07:35 /usr/bin/mou...
-rwxr-xr-x 1 root root 411 11月 7 07:35 /usr/bin/umo...
#br
** avfsを使用する [#b8dac9a7]
avfsのmountには mountavfs を使用します。
- vfsのmountpointを作成
$ cd ~
$ mkdir .avfs
- mount実施
$ mountavfs
Mounting AVFS on $HOME/.avfs...
mount済みなのに mountavfs を実行すると
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' m...
と怒られます。
- mount確認
$ cat /proc/mounts
rootfs / rootfs rw 0 0
:
fuse $HOME/.avfs fuse rw,nosuid,nodev,user_id=***,group_...
- 圧縮ファイルへ介入行動を開始する~
圧縮ファイルをそのままファイルシステムとして使用するには...
このとき圧縮ファイルのファイル名末尾に # を付けてアクセス...
$ cd .avfs/hogehoge/avfs-0.9.8.tar.bz2#/
avfs-0.9.8.tar.bz2# $ ls
avfs-0.9.8
と中身が覗ければOKです。
#br
** avfsを解除する [#b8d7e285]
avfsを解除するには umountavfs を使用します。
- umountavfsの修正~
mount確認は /proc/mounts を見ていますが、どうもgrep対象が...
#!/bin/sh
# umountavfs -- program to unmount avfs file system
# and unload avfsd daemon.
# companion program to mountavfs
# will check to see if avfsd is mounted and then
# unmount using fusermount.
# last updated 20051201
# suggested use: in a logout script or wm exit routine
MntDir=${HOME}/.avfs
grep -q "avfsd ${MntDir}" /proc/mounts && { ★
echo unMounting AVFS on $MntDir...
fusermount -u $MntDir
}
修正します。
$ su
# cp -a /usr/bin/umountavfs /usr/bin/umountavfs.org
修正は以下diffイメージで。
# diff -brNup /usr/bin/umountavfs.org /usr/bin/umountavfs
--- /usr/bin/umountavfs.org 2008-11-07 07:35:17.0000...
+++ /usr/bin/umountavfs 2008-11-08 16:06:53.000000000 +0...
@@ -9,7 +9,7 @@
# suggested use: in a logout script or wm exit routine
MntDir=${HOME}/.avfs
-grep -q "avfsd ${MntDir}" /proc/mounts && {
+grep -q "fuse ${MntDir}" /proc/mounts && {
echo unMounting AVFS on $MntDir...
fusermount -u $MntDir
}
- umount実施
$ umountavfs
unMounting AVFS on $HOME/.avfs...
- umount確認
$ cat /proc/mounts
rootfs / rootfs rw 0 0
:
:
★ $HOME/.avfs のmount情報が無ければOK
#br
** extfs で ulha を使用する [#b27d284c]
- ファイル拡張子が足りなかったりしたら、以下のファイルを...
-- /usr/lib/avfs/extfs/extfs.ini
- lhaで固めたファイルの拡張子は普通 .lzh のはずなのでこん...
$ diff -brNup avfs-0.9.8.tar.bz2#/avfs-0.9.8/extfs/extfs...
--- avfs-0.9.8.tar.bz2#/avfs-0.9.8/extfs/extfs.ini ...
+++ /usr/lib/avfs/extfs/extfs.ini 2009-04-13 00:07...
@@ -5,7 +5,7 @@ u7z .7z
# Popular pc archivers
# uzip .zip .jar
uzoo .zoo
-ulha .lha .lhz
+ulha .lzh .lha .lhz
# urar .rar
uha
# For arj usage you need special patch to unarj
- lha自体がなかったので持ってきて make install しとく~
lhaのソースはここから http://sourceforge.jp/projects/lha/
$ tar xzf lha-1.14i-ac20050924p1.tar.gz
$ cd lha-1.14i-ac20050924p1
$ make
$ su
# make install
- mountavfs し直して適当なファイルで確認
$ umountavfs
$ mountavfs
$ lha l test.lzh
PERMISSION UID GID SIZE RATIO STAMP ...
---------- ----------- ------- ------ ------------ -----...
-rw-r--r-- ****/**** 10 100.0% Apr 13 21:13 test....
---------- ----------- ------- ------ ------------ -----...
Total 1 file 10 100.0% Apr 13 21:13
$ cat .avfs/hogehoge/test.lzh#/test.txt
TEST FILE
#br
** http で AVFS を経由したファイルアクセス - &new(){2011/...
あんまりオープンすぎる http サーバでやるのはどうかな? ...
参考になるのはこちら [[HOWTO: setup avfs / fuse on debi...
apache の RewriteRule を使用することで、 AVFS 経由のフ...
- avfsd の subdir module を使ってマウント
# avfsd -o allow_other -o modules=subdir -o subdir=/opt/...
|~~~~~~~~~~ ~~~~~~~~~~~~~~ |~~~~~~~~~~~...
| | ...
| +- AVFS のル...
+- マウントしたユーザ以外でも参照できるよう a...
- .htaccess もしくは httpd.conf に RewriteRule を作成する
Options +Indexes
RewriteEngine On
RewriteBase /vfs
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*?.zip)$ $1/avfs/ [R,L]
RewriteRule ^(.*?.tar.[bg]z2*)$ $1/avfs/ [R,L]
RewriteRule ^(.*?.t[bg]z2*)$ $1/avfs/ [R,L]
RewriteRule ^(.*)/avfs/(.*)$ $1\%23/$2 [NS,L,NE]
-- たとえばこんな感じ。~
.htaccess で指定する場合は、あらかじめ httpd.conf で Allo...
こうしておくと、ブラウザで http://hogehoge/vfs/fugafuga...
#br
* 更新履歴 [#h9cf5ba9]
- 2011/02/22 ''http で AVFS を経由したファイルアクセス'' ...
- 2009/04/13 lhaも覗けるようにしたので追記
- 2008/11/08 作成
終了行:
[[Linux]]
#contents
* FUSE [#u3980507]
** FUSEとは [#v66864a8]
FUSE - Filesystem in Userspace~
カーネル空間ではなく、ユーザ空間で仮想のファイルシステ...
FUSEはモジュールとしてカーネルに組み込んでおき、あとはF...
sshfsなんかもあるみたいですね。
#br
* AVFS [#b86b7f73]
FUSEを使った仮想ファイルシステムであるAVFSを導入してみ...
#br
** AVFSとは [#ja929ac3]
AVFS - A Virtual File System~
とある通り、linuxの仮想ファイルシステムで、圧縮ファイル...
圧縮ファイルを展開せずに、普段と変わることなくディレク...
DOSのファイラーで圧縮ファイルを仮想ディレクトリとして扱...
#br
** 介入行動の対象 [#qab6eba8]
どんなファイルに対応しているかは avfs のリリースページ...
- 対応ファイル
-- tar
-- gzip
-- bzip2
-- zip
-- ar
-- rar
- extfs で対応
-- cpio
-- rpm
-- lha
-- arj
-- dpkg
-- apt
-- zoo
-- 7z
--- 他にも ftp とか audio とかいろいろ
#br
** 必要ファイルの準備 [#ged2ac80]
AVFS導入のため、以下を用意します。
- fuse~
#ref(http://fuse.sourceforge.net/,FUSE);
- avfs~
#ref(http://avf.sourceforge.net/,AVFS);
kernel 2.6.10(14?) 以上であれば、カーネルコンフィグで C...
うちでは CONFIG_FUSE_FS not set にしていて、カーネルの...
** make [#kc90d77e]
- fuseのmake~
特に何も考えずそのままmake; make installします。
-- tar-ballを展開して
$ tar xzf fuse-2.7.4.tar.gz
$ cd fuse-2.7.4/
-- confiture 〜 make install まで実施
$ ./configure
$ make
$ su
# make install
-- ldconfig実施
# vi /etc/ld.so.conf
/usr/local/lib ★libfuse.soはここに入るので、ld.so.confに...
# ldconfig
- avfsのmake~
-- tar-ballを展開して
$ tar xjf avfs-0.9.8.tar.bz2
$ avfs-0.9.8
-- ''--enable-fuse'' 付きでconfigure
$ ./configure --enable-fuse
:
:
checking whether fuse is new enough... no
:
Building library : yes
Building avfsd for fuse : no ★
:
何ぞ...~
avfsdがmake対象にならないのでconfigure眺めて行ったら
25046 pkg-config --atleast-version=2.6.0 fuse >/de...
ここでfuseのテストフラグが失敗になってるっぽいので、con...
-- ''--disable-fuse-test'' も付けてconfigure
$ ./configure --enable-fuse --disable-fuse-test
:
:
checking whether fuse is new enough... yes
:
Building library : yes
Building avfsd for fuse : yes ★
:
となってくれればOKです。
-- make; make install
$ make
$ su
# make install
bindir等をいじらなければ、以下に主なバイナリとスクリプ...
$ ls -l /usr/bin/*avfs*
-rwxr-xr-x 1 root root 1239 11月 7 07:35 /usr/bin/avf...
-rwxr-xr-x 1 root root 784848 11月 7 07:35 /usr/bin/avfsd
-rwxr-xr-x 1 root root 466 11月 7 07:35 /usr/bin/mou...
-rwxr-xr-x 1 root root 411 11月 7 07:35 /usr/bin/umo...
#br
** avfsを使用する [#b8dac9a7]
avfsのmountには mountavfs を使用します。
- vfsのmountpointを作成
$ cd ~
$ mkdir .avfs
- mount実施
$ mountavfs
Mounting AVFS on $HOME/.avfs...
mount済みなのに mountavfs を実行すると
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' m...
と怒られます。
- mount確認
$ cat /proc/mounts
rootfs / rootfs rw 0 0
:
fuse $HOME/.avfs fuse rw,nosuid,nodev,user_id=***,group_...
- 圧縮ファイルへ介入行動を開始する~
圧縮ファイルをそのままファイルシステムとして使用するには...
このとき圧縮ファイルのファイル名末尾に # を付けてアクセス...
$ cd .avfs/hogehoge/avfs-0.9.8.tar.bz2#/
avfs-0.9.8.tar.bz2# $ ls
avfs-0.9.8
と中身が覗ければOKです。
#br
** avfsを解除する [#b8d7e285]
avfsを解除するには umountavfs を使用します。
- umountavfsの修正~
mount確認は /proc/mounts を見ていますが、どうもgrep対象が...
#!/bin/sh
# umountavfs -- program to unmount avfs file system
# and unload avfsd daemon.
# companion program to mountavfs
# will check to see if avfsd is mounted and then
# unmount using fusermount.
# last updated 20051201
# suggested use: in a logout script or wm exit routine
MntDir=${HOME}/.avfs
grep -q "avfsd ${MntDir}" /proc/mounts && { ★
echo unMounting AVFS on $MntDir...
fusermount -u $MntDir
}
修正します。
$ su
# cp -a /usr/bin/umountavfs /usr/bin/umountavfs.org
修正は以下diffイメージで。
# diff -brNup /usr/bin/umountavfs.org /usr/bin/umountavfs
--- /usr/bin/umountavfs.org 2008-11-07 07:35:17.0000...
+++ /usr/bin/umountavfs 2008-11-08 16:06:53.000000000 +0...
@@ -9,7 +9,7 @@
# suggested use: in a logout script or wm exit routine
MntDir=${HOME}/.avfs
-grep -q "avfsd ${MntDir}" /proc/mounts && {
+grep -q "fuse ${MntDir}" /proc/mounts && {
echo unMounting AVFS on $MntDir...
fusermount -u $MntDir
}
- umount実施
$ umountavfs
unMounting AVFS on $HOME/.avfs...
- umount確認
$ cat /proc/mounts
rootfs / rootfs rw 0 0
:
:
★ $HOME/.avfs のmount情報が無ければOK
#br
** extfs で ulha を使用する [#b27d284c]
- ファイル拡張子が足りなかったりしたら、以下のファイルを...
-- /usr/lib/avfs/extfs/extfs.ini
- lhaで固めたファイルの拡張子は普通 .lzh のはずなのでこん...
$ diff -brNup avfs-0.9.8.tar.bz2#/avfs-0.9.8/extfs/extfs...
--- avfs-0.9.8.tar.bz2#/avfs-0.9.8/extfs/extfs.ini ...
+++ /usr/lib/avfs/extfs/extfs.ini 2009-04-13 00:07...
@@ -5,7 +5,7 @@ u7z .7z
# Popular pc archivers
# uzip .zip .jar
uzoo .zoo
-ulha .lha .lhz
+ulha .lzh .lha .lhz
# urar .rar
uha
# For arj usage you need special patch to unarj
- lha自体がなかったので持ってきて make install しとく~
lhaのソースはここから http://sourceforge.jp/projects/lha/
$ tar xzf lha-1.14i-ac20050924p1.tar.gz
$ cd lha-1.14i-ac20050924p1
$ make
$ su
# make install
- mountavfs し直して適当なファイルで確認
$ umountavfs
$ mountavfs
$ lha l test.lzh
PERMISSION UID GID SIZE RATIO STAMP ...
---------- ----------- ------- ------ ------------ -----...
-rw-r--r-- ****/**** 10 100.0% Apr 13 21:13 test....
---------- ----------- ------- ------ ------------ -----...
Total 1 file 10 100.0% Apr 13 21:13
$ cat .avfs/hogehoge/test.lzh#/test.txt
TEST FILE
#br
** http で AVFS を経由したファイルアクセス - &new(){2011/...
あんまりオープンすぎる http サーバでやるのはどうかな? ...
参考になるのはこちら [[HOWTO: setup avfs / fuse on debi...
apache の RewriteRule を使用することで、 AVFS 経由のフ...
- avfsd の subdir module を使ってマウント
# avfsd -o allow_other -o modules=subdir -o subdir=/opt/...
|~~~~~~~~~~ ~~~~~~~~~~~~~~ |~~~~~~~~~~~...
| | ...
| +- AVFS のル...
+- マウントしたユーザ以外でも参照できるよう a...
- .htaccess もしくは httpd.conf に RewriteRule を作成する
Options +Indexes
RewriteEngine On
RewriteBase /vfs
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*?.zip)$ $1/avfs/ [R,L]
RewriteRule ^(.*?.tar.[bg]z2*)$ $1/avfs/ [R,L]
RewriteRule ^(.*?.t[bg]z2*)$ $1/avfs/ [R,L]
RewriteRule ^(.*)/avfs/(.*)$ $1\%23/$2 [NS,L,NE]
-- たとえばこんな感じ。~
.htaccess で指定する場合は、あらかじめ httpd.conf で Allo...
こうしておくと、ブラウザで http://hogehoge/vfs/fugafuga...
#br
* 更新履歴 [#h9cf5ba9]
- 2011/02/22 ''http で AVFS を経由したファイルアクセス'' ...
- 2009/04/13 lhaも覗けるようにしたので追記
- 2008/11/08 作成
ページ名: