【发布时间】:2014-09-12 15:15:04
【问题描述】:
我在我的服务器上安装了 ubuntu 12.04。
我在根目录中创建了名为“data001”的文件夹。
但是,我无法通过命令 'df' 找到 data001。
我认为我需要将“data001”文件夹挂载为磁盘。
能否告诉我如何将本地目录挂载为磁盘并为该磁盘分配特定内存?
最后,我想通过远程 jenkins 服务器访问“data001”文件夹。
提前感谢您的建议。
【问题讨论】:
我在我的服务器上安装了 ubuntu 12.04。
我在根目录中创建了名为“data001”的文件夹。
但是,我无法通过命令 'df' 找到 data001。
我认为我需要将“data001”文件夹挂载为磁盘。
能否告诉我如何将本地目录挂载为磁盘并为该磁盘分配特定内存?
最后,我想通过远程 jenkins 服务器访问“data001”文件夹。
提前感谢您的建议。
【问题讨论】:
我真的不知道你为什么认为你需要这样做,或者如果将本地文件作为文件系统挂载实际上是解决你问题的最佳解决方案,但这是在 Linux 上执行此操作的一种方法(作为 root 用户) :
# create a file to hold the filesystem as /path/to/local/file
dd if=/dev/zero of=/path/to/local/file bs=1048576 count=<size in MB>
# create a filesystem in the file, where <filesystem> is, for example, 'ext4'
# will prompt asking if it should proceed using a local file
# answer: y
mkfs -t <filesystem> /path/to/local/file
# mount the local file on the target directory
mount /path/to/local/file /path/to/target/directory
除非您相应地配置/etc/fstab,否则安装将在重新启动时丢失。
【讨论】: