Google-Cloud-Platform

為什麼 gcsfuse 掛載後不返回命令提示符?

  • August 7, 2015

我已經成功安裝了gcsfuse。當我執行它時,它會列印出來,File system has been successfully mounted但我不會回到 shell 提示符。(見下面的成績單。)我做錯了什麼?

確認儲存桶存在:

ybaruy_gmail_com@test-fuse:~$ gsutil ls

Updates are available for some Cloud SDK components.  To install
them, please run:
$ gcloud components update

gs://daniella/
gs://test-daniella-nearline/
gs://test-yakov/
gs://yossi-fuse-bucket/

安裝先決條件:

ybaruy_gmail_com@test-fuse:~$ sudo apt-get install wget fuse
Reading package lists... Done
Building dependency tree
Reading state information... Done
wget is already the newest version.
The following NEW packages will be installed:
 fuse
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 74.2 kB of archives.
After this operation, 179 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://security.debian.org/ wheezy/updates/main fuse amd64 2.9.0-2+deb7u2 [74.2 kB]
Fetched 74.2 kB in 0s (1,953 kB/s)
Selecting previously unselected package fuse.
(Reading database ... 20074 files and directories currently installed.)
Unpacking fuse (from .../fuse_2.9.0-2+deb7u2_amd64.deb) ...
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.16.0-0.bpo.4-amd64
/var/tmp/mkinitramfs_4WmsnD/scripts/local-premount/gce-disable-growroot: 7: .: Can't open /scripts/functions
Processing triggers for man-db ...
Setting up fuse (2.9.0-2+deb7u2) ...
Creating fuse group...
Adding group `fuse' (GID 105) ...
Done.
udev active, skipping device node creation.
update-initramfs: deferring update (trigger activated)
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.16.0-0.bpo.4-amd64
/var/tmp/mkinitramfs_PqrQoB/scripts/local-premount/gce-disable-growroot: 7: .: Can't open /scripts/functions
ybaruy_gmail_com@test-fuse:~$ sudo adduser $USER fuse
Adding user `ybaruy_gmail_com' to group `fuse' ...
Adding user ybaruy_gmail_com to group fuse
Done.

安裝 gcsfuse,如下所述

ybaruy_gmail_com@test-fuse:~$ wget https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v0.6.0/gcsfuse_v0.6.0_linux_amd64.tar.gz
--2015-08-04 05:50:34--  https://github.com/GoogleCloudPlatform/gcsfuse/releases/download/v0.6.0/gcsfuse_v0.6.0_linux_amd64.tar.gz
Resolving github.com (github.com)... 192.30.252.129
Connecting to github.com (github.com)|192.30.252.129|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://s3.amazonaws.com/github-cloud/releases/30325550/e406280c-3aab-11e5-92fd-72a098ee49be.gz?response-content-disposition=attachment%3B%20filename%3Dgcsfuse_v0.6.0_linux_amd64.tar.gz&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1438667495&Signature=D4Dq3DdtDIuhmhz4MYCfbIWqvbg%3D [following]
--2015-08-04 05:50:35--  https://s3.amazonaws.com/github-cloud/releases/30325550/e406280c-3aab-11e5-92fd-72a098ee49be.gz?response-content-disposition=attachment%3B%20filename%3Dgcsfuse_v0.6.0_linux_amd64.tar.gz&response-content-type=application/octet-stream&AWSAccessKeyId=AKIAISTNZFOVBIJMK3TQ&Expires=1438667495&Signature=D4Dq3DdtDIuhmhz4MYCfbIWqvbg%3D
Resolving s3.amazonaws.com (s3.amazonaws.com)... 54.231.2.40
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.2.40|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4002177 (3.8M) [application/octet-stream]
Saving to: `gcsfuse_v0.6.0_linux_amd64.tar.gz'

100%[========================================================================================>] 4,002,177   1.09M/s   in 4.2s

2015-08-04 05:50:40 (939 KB/s) - `gcsfuse_v0.6.0_linux_amd64.tar.gz' saved [4002177/4002177]

ybaruy_gmail_com@test-fuse:~$ sudo tar -C /usr/local/bin -zxf gcsfuse_v0.6.0_linux_amd64.tar.gz
ybaruy_gmail_com@test-fuse:~$ sudo chmod g+rw /dev/fuse
ybaruy_gmail_com@test-fuse:~$ sudo chgrp fuse /dev/fuse
ybaruy_gmail_com@test-fuse:~$ mkdir mount-point
ybaruy_gmail_com@test-fuse:~$ logout
Connection to 146.148.112.111 closed.

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Session stopped
   - Press <return> to exit tab
   - Press r to restart session
   - Press s to save terminal output to file





RECONNECTING, PLEASE WAIT...




X11 forwarding request failed on channel 0
Linux test-fuse 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt11-1~bpo70+1 (2015-06-08) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Aug  4 05:45:22 2015 from pavel.iucc.ac.il

執行 gcsfuse:

ybaruy_gmail_com@test-fuse:~$ gcsfuse yossi-fuse-bucket mount-point
2015/08/04 05:51:44.524655 Warning: low file rlimit of 1024 will cause cached content to be frequently evicted. Consider raising with `ulimit -n`.
2015/08/04 05:51:44.954706 File system has been successfully mounted.

預計該gcsfuse命令不會返回到 shell — 它在前台執行,直到文件系統被解除安裝(使用fusermount -u)或它接收SIGINT到,通常通過按 Ctrl-C。有關更多詳細資訊,請參閱文件

如果您想在文件系統在前台執行時與它進行互動,您需要打開另一個 SSH 會話並在那裡進行。或者,您可以使用幫助程序,例如daemon將 gcsfuse 變成在後台執行的守護程序,甚至在您的fstab. 有關詳細資訊,請參閱文件中名為“作為守護程序執行”的部分。

引用自:https://serverfault.com/questions/710661