# Mounting a disk

**URL:** <https://forums.suse.com/t/mounting-a-disk/3519>\
**Category:** RancherOS\
**Created:** [July 25, 2016, 1:46am UTC](https://forums.suse.com/t/mounting-a-disk/3519 "2016-07-25T01:46:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![erichorne](https://avatars.discourse-cdn.com/v4/letter/e/e19adc/32.png) [@erichorne](https://forums.suse.com/u/erichorne)\
**Post date:** [July 25, 2016, 1:46am UTC](https://forums.suse.com/t/mounting-a-disk/3519/1 "2016-07-25T01:46:43Z")

</div>

About 6 months ago, maybe 7, I posted a question about mounting a disk volume for use with containers on RancherOS. The only working answer was to create a [startup.sh](http://startup.sh) file and have that manually mount any other disk volumes that happen to be on the box.

I have to say that is not a satisfying response. Operating Systems have been able to mount multiple disks without having to write custom startup scripts since the 1980’s. Even DOS could do this 🙂

What am I missing? The documentation hints that a cloud-config.yml operator “mounts” exists. I’ve tried several incantations without success. Here’s what I want to do: I want to mount /dev/vbd (that’s right there is no partition) onto /mnt/s on bootup. According to the docs, adding mounts: [[“vdb”,"/mnt/s",“ext4”,“defaults”]] to cloud-config.yml via ros config set is the way to do this. Even with RancherOS 0.5, the device does not get mounted. So I do this:

ros config set mounts ‘[["/dev/vbd","/mnt/s",“ext4”,“defaults”]]’

or this:  
ros config set mounts ‘[[“vbd”,"/mnt/s",“ext4”,“defaults”]]’

and reboot. /mnt/s doesn’t have the device mounted (/mnt/s exists, it’s empty). The device is not mounted at all anywhere. Mounting it by hand mounts the device.

I’ve tried editing /etc/fstab, but of course that doesn’t work because it just gets replaced on startup. Not sure where else to turn (and avoid writing a script to mount the device).

I feel like I’m really missing something fundamental here. Surely there are other people who would like to mount more than the root volume onto a RancherOS based host for use by containers. How are they accomplishing this?

Thanks for you time, desperately trying to adopt RancherOS…

-Eric

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [July 25, 2016, 3:08am UTC](https://forums.suse.com/t/mounting-a-disk/3519/2 "2016-07-25T03:08:09Z")

</div>

We recently updated our docs regarding this and hopefully this updated page will help.

[http://rancher.com/docs/os/latest/en/storage/additional-mounts/](http://rancher.com/docs/os/latest/en/storage/additional-mounts/)

---

<div class="post-metadata">

**Author:** ![erichorne](https://avatars.discourse-cdn.com/v4/letter/e/e19adc/32.png) [@erichorne](https://forums.suse.com/u/erichorne)\
**Post date:** [July 25, 2016, 2:28pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/3 "2016-07-25T14:28:47Z")

</div>

Hi Denise. Thanks for the response. Unfortunately, it does not help. As I said in my note, I’ve tried the mounts directive with no success. Perhaps you can give it another look and help me see where I’m making the mistake?

All I’m trying to do is mount a second disk so that multiple containers can use the second disk without having to write a custom script to run a mount command on bootup.

Thanks again!

-Eric

---

<div class="post-metadata">

**Author:** ![joshwget](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/joshwget/32/704_2.png) [@joshwget](https://forums.suse.com/u/joshwget)\
**Post date:** [July 25, 2016, 3:07pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/4 "2016-07-25T15:07:29Z")

</div>

Are there any issues if you try performing the mount manually in the console container?

Would you mind trying to use an empty string rather than `defaults` as the last parameter for the cloud-config mount? That might be a concept specific to the `mount` command and not the syscall (which RancherOS uses internally).

---

<div class="post-metadata">

**Author:** ![erichorne](https://avatars.discourse-cdn.com/v4/letter/e/e19adc/32.png) [@erichorne](https://forums.suse.com/u/erichorne)\
**Post date:** [July 25, 2016, 3:25pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/5 "2016-07-25T15:25:39Z")

</div>

No issues manually mounting. Did this and rebooted:

```
[root@be002 ~]# ros config set mounts '[["/dev/vdb","/mnt/s","ext4",""]]'
[root@be002 ~]# ros config get mounts
- - /dev/vdb
  - /mnt/s
  - ext4
  - ""

```

and… it worked. Cool! So it might be a good idea to update the storage page in the docs to give a more concrete example. [https://cloudinit.readthedocs.io/en/latest/topics/examples.html#adjust-mount-points-mounted](https://cloudinit.readthedocs.io/en/latest/topics/examples.html#adjust-mount-points-mounted) shows that the fourth element of the array are for mount options; apparently “defaults” is not a valid mount option (don’t know why).

Thanks @joshwget!!

-Eric

---

<div class="post-metadata">

**Author:** ![joshwget](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/joshwget/32/704_2.png) [@joshwget](https://forums.suse.com/u/joshwget)\
**Post date:** [July 25, 2016, 4:15pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/6 "2016-07-25T16:15:31Z")

</div>

Thanks for trying that out! I agree, it’s not a particularly helpful example. I’ll update that and add a note about using `defaults`.

---

<div class="post-metadata">

**Author:** ![EugenMayer](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/eugenmayer/32/1415_2.png) [@EugenMayer](https://forums.suse.com/u/EugenMayer)\
**Post date:** [July 28, 2016, 2:00pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/7 "2016-07-28T14:00:58Z")

</div>

Probably important to notice, that this seems not to work on 0.4.5:

```auto
[root@rancher conf]# ros os version
v0.4.5
[root@rancher conf]# ros config set mounts '[["/dev/vdb","/data2","ext4",""]]'
[root@rancher conf]# ros config get mounts

```

So it seems to not be able to set it

while under 0.5.0

```auto
[root@rancher rancher]# ros os version
v0.5.0
[root@rancher rancher]# ros config set mounts '[["/dev/vdb","/data2","ext4",""]]'
[root@rancher rancher]# ros config get mounts
- - /dev/vdb
  - /data2
  - ext4
  - ""

```

@denise this is probably something for the docs, so people know when the feature has ben introduced

---

<div class="post-metadata">

**Author:** ![denise](https://avatars.discourse-cdn.com/v4/letter/d/82dd89/32.png) [@denise](https://forums.suse.com/u/denise)\
**Post date:** [July 28, 2016, 4:26pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/8 "2016-07-28T16:26:41Z")

</div>

@EugenMayer The docs currently have been written to assume that you are running v0.5.0 as we introduced a lot of new features that don’t exist in previous releases. We hope our users to adopt the latest versions of RancherOS as we are constantly improving and stabilizing it.

We also don’t have the bandwidth to version the docs for RancherOS at this time. There are no plans on versioning RancherOS docs until GA.

---

<div class="post-metadata">

**Author:** ![EugenMayer](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/eugenmayer/32/1415_2.png) [@EugenMayer](https://forums.suse.com/u/EugenMayer)\
**Post date:** [July 29, 2016, 7:30am UTC](https://forums.suse.com/t/mounting-a-disk/3519/9 "2016-07-29T07:30:59Z")

</div>

@denise i understand that versioning docs is not a minimal time job. Just maybe a notice. I tried to get this feature working for over one hour. The issue is, you do not have any error message when seeing mounts in 0.4.5 and due to this, it could make sense, warning you user base.

Also this is not mentioned in the changelogs, only shared mounts are mentioned there (and resizefs)

A lot of other features introduced at least have an error or “missing” button making it easy to distinct.

Nevertheless, its not too critical either - maybe google will help one or the other

---

<div class="post-metadata">

**Author:** ![jhmartin](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jhmartin/32/1598_2.png) [@jhmartin](https://forums.suse.com/u/jhmartin)\
**Post date:** [August 15, 2016, 7:44pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/10 "2016-08-15T19:44:22Z")

</div>

I am seeing a similiar issue, AWS w/the 0.5.0 AMI, using a preformatted 50G ext4 volume for /dev/xvdf:

```
# ros os version
v0.5.0

# ros config get mounts
- - /dev/xvdf
  - /var/lib/docker
  - ext4
  - ""

# fdisk /dev/xvdf
[snip]
Device /dev/xvdf already contains a ext4 signature.

```

My cloud-config:

```
#cloud-config
mounts:
  - ["/dev/xvdf", "/var/lib/docker", "ext4", ""]

```

Yet no mount and no error message about it in any docker or system log.

_I used a preformatted volume as I can’t find a way to format a new EBS volume at boot time._

---

<div class="post-metadata">

**Author:** ![joshwget](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/joshwget/32/704_2.png) [@joshwget](https://forums.suse.com/u/joshwget)\
**Post date:** [August 16, 2016, 5:42am UTC](https://forums.suse.com/t/mounting-a-disk/3519/11 "2016-08-16T05:42:00Z")

</div>

If you perform the mount manually does it work? Can you show the output of `system-docker logs console`?

---

<div class="post-metadata">

**Author:** ![huggla](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/huggla/32/3050_2.png) [@huggla](https://forums.suse.com/u/huggla)\
**Post date:** [January 24, 2017, 11:42am UTC](https://forums.suse.com/t/mounting-a-disk/3519/12 "2017-01-24T11:42:22Z")

</div>

It doesn’t seem to work on v0.7.1 when booting from iso with a RENCHER\_STATE drive set.

```
[rancher@rancher ~]$ sudo ros os version
v0.7.1
[rancher@rancher ~]$ sudo ros config get mounts
- - /dev/sdb
  - /mnt/sdb
  - ext4
  - ""

```

Edit:  
Never mind, it works. I had to create /mnt/sdb prior boot.

---

<div class="post-metadata">

**Author:** ![Mountain\_Storm](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/mountain_storm/32/2801_2.png) [@Mountain\_Storm](https://forums.suse.com/u/Mountain_Storm)\
**Post date:** [September 10, 2017, 2:34pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/13 "2017-09-10T14:34:44Z")

</div>

Just stopped to say that seems link you provided doesn’t work.

---

<div class="post-metadata">

**Author:** ![vincent](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/vincent/32/7156_2.png) [@vincent](https://forums.suse.com/u/vincent)\
**Post date:** [September 10, 2017, 11:38pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/14 "2017-09-10T23:38:51Z")

</div>

@Mountain_Storm updated to [http://rancher.com/docs/os/latest/en/storage/additional-mounts/](http://rancher.com/docs/os/latest/en/storage/additional-mounts/) .

---

<div class="post-metadata">

**Author:** ![powareverb](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/powareverb/32/4522_2.png) [@powareverb](https://forums.suse.com/u/powareverb)\
**Post date:** [October 11, 2018, 1:39am UTC](https://forums.suse.com/t/mounting-a-disk/3519/15 "2018-10-11T01:39:12Z")

</div>

FYI - I know this is an old thread but trying to find info on where this is documented. This link redirects to:  
[https://rancher.com/docs/os/v1.x/en/storage/additional-mounts/](https://rancher.com/docs/os/v1.x/en/storage/additional-mounts/)  
Which is also a 404

---

<div class="post-metadata">

**Author:** ![superseb](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/superseb/32/2424_2.png) [@superseb](https://forums.suse.com/u/superseb)\
**Post date:** [October 11, 2018, 1:12pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/16 "2018-10-11T13:12:51Z")

</div>

[https://rancher.com/docs/os/v1.x/en/installation/storage/additional-mounts/](https://rancher.com/docs/os/v1.x/en/installation/storage/additional-mounts/)

---

<div class="post-metadata">

**Author:** ![bott0r](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/bott0r/32/4682_2.png) [@bott0r](https://forums.suse.com/u/bott0r)\
**Post date:** [December 6, 2018, 2:49pm UTC](https://forums.suse.com/t/mounting-a-disk/3519/17 "2018-12-06T14:49:07Z")

</div>

Coming back to this. Without a nfs client i can just mount via a simple line:  
`sudo mount -t nfs4 192.168.0.2:/mnt/volume01/data /mnt/data`

However when i translate thet line to a cloudconfig with either:

```auto
#/var/lib/rancher/conf/cloud-config.d/z.yml
mounts:
- ["192.168.0.2:/mnt/volume01/data", "/mnt/data", "nfs4", ""]

```

or with

`ros config set mounts '[["192.168.0.2:/mnt/volume01/data", "/mnt/data1", "nfs4", ""]]'`

it just doesnt work, what am i missing, i crawled by now through the documentation that is available or cached 404 pages, along side closed github issues. does anyone have a pointer here?

---

<div class="post-metadata">

**Author:** ![Jason-ZW](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jason-zw/32/4607_2.png) [@Jason-ZW](https://forums.suse.com/u/Jason-ZW)\
**Post date:** [December 10, 2018, 6:07am UTC](https://forums.suse.com/t/mounting-a-disk/3519/18 "2018-12-10T06:07:41Z")

</div>

@bott0r

> <https://github.com/rancher/os/issues/2381>
>
> \*\*RancherOS Version: (ros os version)\*\*
> v1.4.0
> 
> \*\*Where are you running Ranch…erOS? (docker-machine, AWS, GCE, baremetal, etc.)\*\*
> AWS
> 
> I am attempting to use cloud-config to format and mount the ephemeral instance store in a new m5d instance:
> 
> \`\`\`
> \#cloud-config
> bootcmd:
> - \[mkfs.ext2, /dev/nvme1n1 \]
> mounts:
> - \[/dev/nvme1n1, /storage, ext2, "" \]
> rancher:
> docker:
> extra\_args:
> - "-g"
> - /storage
> \`\`\`
> 
> When the instance starts up, \`/storage\` exists, and user-docker has put its state there. However, \`nvme1n1\` is not formatted, and there is no mount on \`/storage\`
> 
> Any ideas? I have been unable to find any logs or errors that show what is happening during the bootstrap.

Try using `runcmd`:

```auto
#cloud-config
runcmd:
  - [mkfs.ext2, /dev/nvme1n1]
  - [mkdir, -p, /storage]
  - [mount, -t, ext2, /dev/nvme1n1, /storage]

```

---

<div class="post-metadata">

**Author:** ![bott0r](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/bott0r/32/4682_2.png) [@bott0r](https://forums.suse.com/u/bott0r)\
**Post date:** [December 10, 2018, 6:57am UTC](https://forums.suse.com/t/mounting-a-disk/3519/19 "2018-12-10T06:57:11Z")

</div>

I tried various combinations and it wont work for me on 1.5.  
this is the last i tried.

```
#cloud-config
runcmd:
- [mkdir, -p, /mnt/storage]
- [mkdir, -p, /mnt/data]
- ["mount", "-t", "nfs4","192.168.0.2:/mnt/volume01/data", "/mnt/data"]

```

Folders get created, but nothing will be mounted, if i take the quotation marks away ros config validate will complain. anything else i could try?

---

<div class="post-metadata">

**Author:** ![Jason-ZW](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/jason-zw/32/4607_2.png) [@Jason-ZW](https://forums.suse.com/u/Jason-ZW)\
**Post date:** [December 10, 2018, 8:08am UTC](https://forums.suse.com/t/mounting-a-disk/3519/20 "2018-12-10T08:08:14Z")

</div>

I will try nfs on my own rancheros1.5 and will give you feedback tomorrow.

[Next page](https://forums.suse.com/t/mounting-a-disk/3519.md?page=2)
