- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 vagrant 的新手,正在尝试将第二个磁盘添加到我正在用 vagrant 制作的虚拟机中。
我想出了如何在第一次启动虚拟机时连接磁盘,但是当我关闭机器时
然后再次备份(使用 'vagrant up --provision' 以确保配置器运行)我对磁盘所做的更改
丢失了。
我使用日志记录运行了两次,第二次运行的日志输出(机器初始配置后的重新启动)显示正在执行 storageattach 命令。但是我在“/dev/shm”(似乎是第二个磁盘的挂载点)下创建的每个文件都消失了。
故障模式为:
Vagrant 起来...
touch /dev/shm/some.file
ls /dev/shm/some.file # see output here...
ls /dev/shm/some.file # no such file or directory.. where did it go ?
Vagrant.require_version ">= 1.4.3"
VAGRANTFILE_API_VERSION = "2"
disk = './secondDisk.vdi'
BOX_NAME="test"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :master do |master|
master.vm.box = "centos65"
master.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box"
master.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", "4196"]
v.name = BOX_NAME
end
master.vm.network :private_network, ip: "192.168.33.10"
master.vm.hostname = BOX_NAME
end
config.vm.synced_folder(".", "/vagrant",
:owner => "vagrant",
:group => "vagrant",
:mount_options => ['dmode=777','fmode=777']
)
config.vm.provider "virtualbox" do |vb|
unless File.exist?(disk)
vb.customize ['createhd', '--filename', disk, '--variant', 'Fixed', '--size', 1 * 1024]
end
vb.customize ['storageattach', :id, '--storagectl', 'SATA', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', disk]
end
end
INFO sanedefaults: Automatically figuring out whether to enable/disable NAT DNS proxy...
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "modifyvm", "ea5c09 e7-11e7-4630-a7ca-ec66461b9eb6", "--natdnsproxy1", "on"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
INFO warden: Calling IN action: #<VagrantPlugins::ProviderVirtualBox::Action::Customize:0x3dc9818>
INFO interface: info: Running 'pre-boot' VM customizations...
INFO interface: info: ==> master: Running 'pre-boot' VM customizations...
==> master: Running 'pre-boot' VM customizations...
INFO subprocess: Starting process: ["C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe", "storageattach", "e a5c09e7-11e7-4630-a7ca-ec66461b9eb6", "--storagectl", "SATA", "--port", "1", "--device", "0", "--type", "hdd", "- -medium", "./secondDisk.vdi"]
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
最佳答案
感谢宝马精心设计和时尚的回答,还有彼得。引用的文章 (gist.github.com/leifg/4713995) 有魔力,我将在下面的 Vagrant 脚本和相应的引导文件中重现,该文件从新添加的第二个磁盘创建文件系统,并将其添加到/etc/fstab。这完全解决了我的问题[不再丢失数据]。
Vagrant 文件:
Vagrant.require_version ">= 1.4.3"
VAGRANTFILE_API_VERSION = "2"
disk = './secondDisk.vdi'
BOX_NAME="test"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.define :master do |master|
master.vm.box = "centos65"
master.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.5.1/centos65-x86_64-20131205.box"
master.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--memory", "4196"]
v.name = BOX_NAME
end
master.vm.network :private_network, ip: "192.168.33.10"
master.vm.hostname = BOX_NAME
end
config.vm.synced_folder(".", "/vagrant",
:owner => "vagrant",
:group => "vagrant",
:mount_options => ['dmode=777','fmode=777']
)
# create the second disk and attach it
config.vm.provider "virtualbox" do |vb|
unless File.exist?(disk)
vb.customize ['createhd', '--filename', disk, '--variant', 'Fixed', '--size', 1 * 1024]
end
vb.customize ['storageattach', :id, '--storagectl', 'SATA', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', disk]
end
# NEW - invoke script which partitions the new disk (/dev/sdb)
# and create mount directives in /etc/fstab
#config.vm.provision :shell, path: "bootstrap.sh"
config.vm.provision "shell" do |shell|
shell.inline = "sudo /vagrant/bootstrap.sh"
end
end
#!/bin/bash -x
# configure and mount second disk
#
yum install -y parted
parted /dev/sdb mklabel msdos
parted /dev/sdb mkpart primary 512 100%
mkfs.xfs /dev/sdb1
mkdir /mnt/disk
echo `blkid /dev/sdb1 | awk '{print$2}' | sed -e 's/"//g'` /mnt/disk xfs noatime,nobarrier 0 0 >> /etc/fstab
mount /mnt/disk
关于vagrant - vb.customize 'storageattach' 第一次挂载我的磁盘,但在 vagrant pause 后更改丢失; Vagrant 起来,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27501019/
我在服务器启动时创建一个缓存(服务器启动每次都需要10分钟)。目前我正在使用内存缓存(Ehcache)。现在我想建立一个机制,以便一旦数据被缓存我应该能够在几秒钟内启动服务器。比如将缓存的持久副本写入
我编写 json 结构的方式使得文件(在进行了一个月的测量后)存储在磁盘上时仍然只有 100 MB 左右。但是现在文件大约是 20mb,但我看到我的脚本需要的内存大约是 200/300 mb。显然,脚
Solaris9 x86下如何挂载和永久挂载windows fat32分区 临时挂载Shell 命令; mout –F pcfs /dev/dsk/c1d0p0:c /mnt/c mount
磁盘ID中的资源组名称大小写不敏感。重现此问题的步骤 - 在 Azure 中创建独立磁盘,检查 ID。对于例如 -“/subscriptions/subscriptionID/resourceGrou
我已将附加数据磁盘的备份还原到新虚拟机。当我发出命令 sudo blkid 时,我发现它与附加到原始虚拟机的数据磁盘具有相同的 UUID,因此我无需更改 fstab 即可在启动时挂载它。然而,它似乎是
在用户态中,执行磁盘 IO 就像链接 C 库一样简单,或者,如果您喜欢冒险,可以直接执行系统调用。我想知道内核本身是如何执行 IO 的。 换句话说,假设我在裸机上以特权模式运行应用程序。我将如何访问通
我已将附加数据磁盘的备份还原到新虚拟机。当我发出命令 sudo blkid 时,我发现它与附加到原始虚拟机的数据磁盘具有相同的 UUID,因此我无需更改 fstab 即可在启动时挂载它。然而,它似乎是
我正在尝试使用 laravel 和 ffmpeg 创建缩略图。但是我收到了这个错误。 磁盘 [视频] 没有配置驱动程序。 我的代码 public function index() { FFMp
我的目标是读/写 usb。 首先必须打开并读取 usb 低级别,如“程序” 我使用 visual c++ 和 winAPI 下面是我的测试代码 char path[64]; sprintf(path,
内核缓冲区缓存何时为空?这似乎不是 LINE Buffering。如果我写 () 一个没有换行符的字符串,它会立即输出到文件。 另外,socket文件的输入输出缓冲区是否也像Disk I/O一样使用内
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我有一个大型调用中心,有 250 个并发调用。队列日志的队列应用程序平面文件。该系统使用 Asterisk 和 Queuemetrics。两个服务都在同一台服务器上运行。规范为 16 核和 64 GB
我在使用安装了 Centos7 的 VMWare VM 时遇到问题。 lsblk 命令给出如下内容 df -h 给出这个 我正在尝试将 root lvm 扩展到分区,但无论我如何尝试都无法做到这一点。
在基于内存的计算模型中,通过考虑数据结构,可以抽象地完成唯一需要进行的运行时计算。 但是,关于高性能磁盘 I/O 算法的文档并不多。因此,我提出了以下一组问题: 1) 我们如何估计磁盘 I/O 操作的
我不是在寻找调用命令行实用程序的代码,它可以解决问题。我实际上很想知道用于创建 RAM 磁盘的 API。 编辑 动机:我有一个第三方库,它需要一个目录名,以便以某种方式处理该目录中的文件。我将这些文件
MySQL 数据库显示磁盘 I/O 利用率持续保持在 100% 左右。数据库服务器有 24 GB 内存。 我们尝试优化查询,但效果不佳。 请检查如下所示的当前配置参数: 参数 当前值 key_buff
这是交易。我们本可以采用完全静态 html 的方式来解决性能问题,但由于该站点将是部分动态的,因此这对我们来说行不通。我们想到的是使用 memcache + eAccelerator 来加速 PHP
对于游戏 Minecraft,运行服务器应用程序时的一般方法是在 RAMDisk 中运行它,因为它使用数百个小文件来生成世界,I/O 速度是主要瓶颈。 在最近的尝试中,我尝试使用 Dokan/ImDi
当我查找文件中的某个位置并写入少量数据(20 字节)时,幕后发生了什么? 我的理解 据我所知,可以从磁盘写入或读取的最小数据单位是一个扇区(传统上是 512 字节,但该标准现在正在改变)。这意味着要写
如何使用golang获取xen服务器的内存、磁盘、网络和cpu信息? 是否有任何可用的软件包? 最佳答案 与其他服务器有什么不同?如果没有 - 有一堆 Go 包可以做到这一点,我正在使用这个 - ht
我是一名优秀的程序员,十分优秀!