stickmount 怎么用mount一个ftp

15513人阅读
Linux(17)
当系统出现问题的时候,可能需要重装系统,这个时候我们往往会使用系统盘将系统重新安装在盘上,其他盘上的文件都没有受到重装系统的影响,这就是分区的好处之一。同样,在中也需要分区,但是中对于分区的表示方式与并不一样。下面将以我的电脑为例,讲述的分区方法并且通过讲述的启动过程来了解系统和挂载。(本文章适合初学的同学学习)
.基本概念
.分区的概念
分区从实质上说就是对硬盘的一种格式化。当我们创建分区时,就已经设置好了硬盘的各项物理参数,指定了硬盘主引导记录和引导记录备份的存放位置。而对于文件系统以及其他操作系统管理硬盘所需要的信息则是通过之后的高级格式化。安装操作系统和软件之前,首先需要对硬盘进行分区和格式化,然后才能使用硬盘保存各种信息。各个分区之间是相对独立的,你在一个分区上的操作不会影响到另一个分区。
之前我们都会认为盘就是第一分区,盘就是第二分区。其实这种看法是不恰当的,盘,盘等都是盘符号,是赋予的名称。在没有启动之前,它们就是一个个分区,而不是具体的盘符。这种盘符的概念,是内在”的,也就是说就算是硬盘上没有安装系统,硬盘上的分区还是存在的。所以可以这样说:盘符是软件级的概念;分区是硬件级的概念。
.文件系统的组织方式
文件系统的组织方式称做文件系统分层标准,即采用层次式的树状目录结构。在此结构的最上层是根目录“,然后在此根目录下是其他的目录和子目录。和一样,采用“路径”来表示文件或目录在文件系统中所处的层次。路径由以“为分隔符的多个目录名字符串组成,分成绝对路径和相对路径。中所谓绝对路径是指由根目录“为起点来表示系统中的某个文件或者目录的位置的方法;相对路径则是以当前目录为起点,表示系统中某个文件或者目录在文件系统中的位置的方法。例如(以我电脑为例):在终端输入(中的显示当前所在位置的命令),终端显示了“,这就是绝对路径。假如文件夹下有一个文件夹,在终端输入(或者),或者就是相对于文件夹的相对路径,其中“表示当前目录,通常可以省略。下面介绍一下中部分目录及其功能说明(以便后面讲述分区和启动过程)
:文件系统的最上层目录,其他所有目录均是该目录的子目录
:的缩写,存放用户的可执行程序,例如和等;也存放,如和。不应把该目录放到一个单独的分区中,否则模式无法使用这些命令。
:内核就放在这里;操作系统启动时所需的文件,包括和等,这些文件若损坏常会导致系统无法正常启动,因此最好不要做任意改动
:设备文件目录,例如表示第一块设备,表示第一块设备后面会讲到中对和接口硬盘的表示方法
:普通用户的主目录或站点目录,一般存放在目录下。(想要了解中其他默认目录中的功能,请查看:)
.中的挂载点
系统下的分区很明了,一个分区就是一个盘符。如果有可以兼容的文件系统,系统也可以读写那个分区。如果是不兼容的文件系统,就会忽略这个分区。
就是把所有的一切都放到一颗“大树”下。如果你有另外的分区或者硬盘,它们就会“挂载”到枝干的子目录中,例如或者目录,这个子目录就是所谓的挂载点,你可以将分区挂载到任意的目录中。
.分区的建议
分区关系到一个系统的安全性和健壮性,当系统出现问题的时候,我们应该以最小的改动来完成系统的修复,这样就能减少不必要的损失。
在安装系统时候,我将硬盘分为四个分区:第一个分区挂载在“目录下,第二个分区挂载在“下第三个分区挂载在“下,第四个分区是交换分区(分区)
一个根分区。根分区是挂载在“目录上的。用来存放系统文件。
分区:这是用户的目录所在地它的大小取决于你的系统有多少用户,以及这些用户将存放多少数据。当你系统受损需要重新安装的时候,不会影响到“分区下的文件。
分区:包含了操作系统的内核和在启动系统过程中所要用到的文件。独立挂载的好处是可以让多个共享一个。“目录的大小通常都很小,左右。可以根据自己的硬盘空间分配一块给分区,但是不要太大,否则是种浪费。
一个交换分区。交换分区用来支持虚拟内存。如果你的计算机内存小于,就必须创建交换分区。即使你有更多的内存,仍然推荐使用交换分区。物理内存小于或等于,建议分配实际物理内存容量倍大小的;物理内存大于,建议分配与物理内存等容量的。
.的启动过程(以我的电脑为例)
系统的启动是从读取开始的(一个来自项目的多操作系统启动程序。是多启动规范的实现,它允许用户可以在计算机内同时拥有多个操作系统,并在计算机启动时选择希望运行的操作系统。可用于选择操作系统分区上的不同内核,也可用于向这些内核传递启动参数。文件的位置是在目录下。(如果电脑上安装的是双系统的话,也可以通过修改文件,来改变系统的启动顺序,等待时间等。)将文件打开后文件中有这么一段:
这是一个标准的引导菜单,那一行显示了该项目的名称,是下的指令,是加载模块的意思。这里涉及到了分区的命名,下面就来了解一下:
系统中存储设备的两种表示方法
对于接口的硬盘的两种表示方法
接口中的整块硬盘在系统中表示为,比如,以此类推。另一种表示方法是,其中是一个正整数,比如;如果机器中只有一块硬盘,无论(命令可查看硬盘及硬盘上的分区情况)列出的是还是,都是如果机器中存在两个或两个以上的硬盘,第一个硬盘另一种方法表示为第二个硬盘,另一种表示是。
接口硬盘分区的两种表示方法
硬盘分区的第一种表示方法,是一个从开始的正整数;比如,,如果的值是到表示硬盘的主分区(包含扩展分区);逻辑分区从是从开始的,比如肯定是逻辑分区。
硬盘分区的第二种表示方法,前面已经说过了整块硬盘也有两种表示方法,一种是的,另一种方法是;一个硬盘分区首先要确认在哪个硬盘,然后再确认它所在的位置;所以我们要知道一个硬盘分区,除了知道以外,还要知道他在哪个位置,确认了分区在后,还要通过来确认具体位置;的值是中的。
关于和接口的硬盘的两种表示方法
方法和接口的硬盘相同,只是把换成。
下面通过实例来认识一下:在终端下输入命令(要在超级用户下查看)
文件中的第一行:,这个就是表示机器中只有一个硬盘设备,大小为
;下面的就是硬盘的分区,每个分区都有详细的信息。
讲到这里,我们都会有点奇怪,既然上面说了接口是表示,和接口都是表示,那为什么文件有一行“代码呢?不应该是“吗?通过在网上查找的相关资料,对于文件来说,硬盘都是用表示的,磁盘号是从开始计算的,分区号是则是从开始计算的(是从开始计算的,是从开始计算的),而对于内核来说,硬盘是表示的,硬盘是用表示的,磁盘序号从开始计算的,分区号是从开始计算的。我电脑中的系统是版本,文件是版本。所以文件中的(,)代表的是第一块硬盘上的第八个分区即。
继续讲解上面的文件,指令是寻找内核的意思,这就真正进入了系统的引导过程,内核的存放位置是在目录下。下面一行中的是一个指令,它告诉程序使用后面给出的内核,于是这个名为“的内核就被载入内存,并读取“这个分区的一些必要的文件。上段代码中的最后一行的命令的意思是:用名为“的文件先在内存中构造一个“虚拟”的根文件系统,以便于内核检测完硬件信息后载入必需的模块等等。的工作到此结束,下面将由内核接管电脑的控制权,开始初始化阶段。到目前为止还没有挂载根分区。然后系统会读取一个名为的文件,并按照其中的指令逐行的执行,下面来看一下文件。以下是我的电脑中的文件:
号开头的行是注释,是说明性的文字,在执行指令的时候并不会执行它。
挂载分区的时候将自上而下,顺序执行。第一个起作用的行是,关于的介绍请查看
首先要将挂载到”下,这就是最先被挂载的根分区;然后继续把挂载到“,挂载到“下,挂载”到交换分区,这个交换分区有点特殊,因为他并没有被“附属”于,而是独立使用的。
到此为止,中系统用到的分区都已经挂载完毕。可以使用系统了。
.手动挂载分区
有人会问,当我需要使用下的分区时怎么办?能不能在下挂载分区呢?答案是肯定的,如果你使用的是桌面版的,并且是双系统,那么点击中的“位置”计算机,里面就列出了中的分区,点击右键,选择“挂载”就可以了,默认是挂载在目录下,我们可以通过命令设定想要挂载的分区及其要挂在到的位置,比如,我想要挂载分区,其文件系统格式是,把它挂载在目录下。具体命令如下:
执行上述命令,可以在目录下查看分区中的文件了。
卸载的命令也很简单,执行命令:(或者)就了。
参考文献:
细说挂载——:
硬盘分区细节详谈
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:388104次
积分:4350
积分:4350
排名:第5451名
原创:70篇
评论:76条
(1)(3)(2)(5)(3)(3)(4)(4)(7)(6)(2)(8)(4)(8)(6)(3)(5)(2)Linux: Mount FTP as File SystemMount FTP volumes locally with ftpfs - TechRepublic
The ability to mount FTP volumes locally gives administrators a real alternative to using NFS. It also gives users the ability to browse FTP servers while maintaining the advantages of operating with a local file system. You can use the ftpfs system on a LAN or on any remote FTP server to which users have access. This Daily Feature will describe how to install and configure ftpfs, either as a kernel module or as a kernel patch.To build ftpfs as a stand-alone kernel module, you'll need the following files:The latest version of ftpfs, matching your kernel. The package is available from the . I used ftpfs-0.6.2-k2.4.tar.gz for this article.The header files for the kernel must be installed. Almost all Linux distributions include the kernel headers with their default installation.To build ftpfs as a kernel patch, you'll need the following files:The ftpfs kernel patchThe latest version is ftpfs-0.3.0-k2.4.4.patch.gzThe ftpmount source codeKernel source codeKernel headersTo build ftpfs as a kernel module, first unpack the gzipped archive with this command:tar -zxvf ftpfs-0.6.2-k2.4.tar.gzWhen the archive is unpacked, the directory ftpfs-0.6.2-k2.4 will be created. CD into the ftpfs-0.6.2-k2.4 directory and run the following command to build and install the ftpfs.o module and the ftpmount binaries:make installTo create an automount directory for ftpfs, run the following command:make install_automountBefore applying the kernel patch, you must install the kernel source code and header files. These files are typically located in /usr/src/linux. Next, run the following series of commands:cp ftpfs-0.3.0-k2.4.4.patch.gz /usr/srccd /usr/srcgunzip ftpfs-0.3.0-k2.4.4.patch.gzcat ftpfs-0.3.0-k2.4.4.patch | patch -Np0Once you’ve applied the patch to the kernel source, the next step is to compile the new kernel. Enter the /usr/src/linux directory and run any one of the following three commands:make configmake menuconfigmake xconfigWhen you’ve selected the options for the new kernel, enable support for ftpfs under File Systems/Network FileSystems menu. When all of the options for the new kernel are selected, run the following series of commands to build your new kernel:make mrpropermake depmake cleanmake bzImagemake modulesmake modules_installThe ftpmount source code isn’t included with the kernel patch, so you have to compile it separately. To compile and build ftpmount, unpack its source code archive with this command:tar -zxvf ftpmount-1.1.tar.gzThe ftpfs module is also capable of running with automount / autofs. To mount FTP automatically in the /mnt/ftpfs directory, use the following command to build ftpfs:make install_automountThe ftpmount-1.1 directory will be created when the packaged is unpacked. Finally, enter the ftpmount-1.1 directory and run the following commands as root:makemake installMounting FTP volumes
The biggest drawback to using ftpfs is the amount of bandwidth required. If you use a cable, ADSL, or similar Internet connection, you should have no problems. However, a dial-up connection probably won't provide the performance you're looking for.
The ftpmount command uses this format:ftpmount &user:password@ftp-server:port-number root-directory mount-point -own -uid -gid -fmask -dmask -active&Below is an explanation of the ftpmount command:User - The user namePassword - The user passwordFtp-server - The FTP serverPort - The port the FTP server is usingRoot directory - The directory on the FTP server that wil this directory is normally specified without the trailing slashMount-point - The mount point for FTP volumes on the local systemOwn - This option forces ownership of all remote filesUID - The User IdentificationGID - The Group IdentificationFmask - The numerical mode applied to all mounted filesDmask - The numerical mode applied to all mounted directoriesActive - Enables support for active mode FTP transfersExample
This is an example of how you might use the ftpmount command.ftpmount
jcmcintyre:abc123@update-server1:21 /linux-2.4 /mnt/ftpupdates -own -uid=500 -gid=500 -fmask=660 -dmask=770
In this example, the FTP server is actually located on the local network, and it’s used to provide software updates. The user password doesn't have to be passed as a command parameter since ftpmount will ask for it.
If ftpmount isn't installed with ftpfs, you can use the mount command to mount remote FTP volumes. When you use the mount command, you must use the FTP server's IP address. For example, to mount the /pub/updates on the FTP server at 192.168.1.100 on a local system using the mount point /mnt/ftpfs, use the following command:mount
-n -t ftpfs none /mnt/ftpfs -o ip=192.168.1.100 user=jim pass=123abc port=21 root=/pub/updates uid=500 gid=500 fmode=660 dmode=770 This command will mount the /pub/updates directory on the FTP server at /mnt/ftpfs on the local system. The local user would also assume ownership of all files in the local mounted volume.Here are some useful tips to remember about the mount command:Forcing file ownership is convenient when the FTP server uses unconventional file access permissions.Use the -n option with the mount command. This prevents the user password information form being written to /etc/mtab.To unmount any mounted FTP volumes, use the umount command. For example, if an FTP volume is mounted at /mnt/ftpfs, use the command:umount /mnt/ftpfsThere are some points to remember about using ftpfs:Limit the number of processes reading the mount point concurrently.Concurrent access will work, but when only one process reads the mount point while the TCP connection is kept alive. Allowing other processes to read the mount will degrade performance.
Tech News You Can Use
We deliver the top business tech news stories about the companies, the people, and the products revolutionizing the planet.
Delivered Daily
Best of the Week
Our editors highlight the TechRepublic articles, galleries, and videos that you absolutely cannot miss to stay current on the latest IT news, innovations, and tips.
Delivered Fridays在linux下怎么mount网络硬盘或者目录呢?这里提供一个工具:fuse从fedora8安装如下:yum install fuse-sshfs-1.9-2.fc8 fuse-libs-2.7.3-2.fc8
fuse-smb-0.8.7-1.fc8 fuse-2.7.3-2.fc8 fuse-devel-2.7.3-2.fc8
fuseiso-.fc8完成对fuse的安装;该软件也是开源的,若想从源码安装,请参观官方开源网站:1,如何mount?# sshfs [user@]host:[dir] mountpointor# sshfs [user@]host:[dir] mountpoint -o allow_other2,如何卸载?# fusermount -u mountpoint3,注意事项有些平台的需要进行内核装入fuse才能使用,所以编译时要么使用该fuse内核版本的包安装,或者源码和内核一起编译安装,对于有些发行版本,可以采用如下方式:#modprobe fuse加载一下fuse模块,然后mount。
on March 24,
发表于 March 24,
此Blog上的上一篇日记。
此Blog上的下一篇日记。
在和页可以看到最新的日记和所有日记。
选择月份...
August 2012
November 2011
October 2011
September 2011
August 2011
April 2011
March 2011
February 2011
January 2011
December 2010
November 2010
October 2010
September 2010
August 2010
April 2010
March 2010
February 2010
January 2010
December 2009
November 2009
October 2009
September 2009
August 2009
April 2009
March 2009
February 2009
January 2009
December 2008
November 2008
October 2008
September 2008
August 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
April 2007
March 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
April 2006
此Blog中的日记遵循。}

我要回帖

更多关于 linux mount ftp路径 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信