attached volume of a FreeBSD amazon ec2 instance does not show up
I have followed the steps in the documentation, created a new EBS volume and attached it to the instance (I only have one). I rebooted and tried shutdown/start, but the device does not show up inside the FreeBSD instance. I only have /dev/ada0
and /dev/ada0a
.
Are there maybe any other steps necessary to make this work for a FreeBSD instance? I don't know anything about the abstraction layers amazon is using. I guess a problem could be that FreeBSD device naming is different.
@hasufell, your comment is correct - the device on BSD instances is not named using Linux/std AWS naming. I got the same device name you did - xbd5
- but you can confirm what the device name is by reviewing the system logs for <Virtual Block Device>
entries (either grep dmesg/messages or through AWS Instance control panel - select instance, then Actions -> Instance Settings -> Get System Log). A 100GB device might show up like this in the log:
xbd5: 102400MB <Virtual Block Device> at device/vbd/51792 on xenbusb_front0
You can also run sysctl kern.disks
and you should see something like:
kern.disks: xbd5 ada0
... where ada0
is your first EBS volume and xbd5
is your new attached volume.
Then just mount your new volume:
newfs /dev/xbd5
mkdir /yourvol
mount /dev/xbd5 /yourvol
Add to /etc/fstab
to mount at boot:
/dev/xbd5 /yourvol ufs rw 0 2
You may need to add a partition number if the first partition is not of type "freebsd-ufs". For example, if you have a boot volume from machine A that you want to mount, for maintenance purposes, to machine B, then your first partition may be type freebsd-boot
, and mount /dev/<device> /yourvol
will fail with a "No such file or directory" error.
As a general solution, regardless of whether working with a blank or populated new volume and whether the first partition is or isn't "freebsd-ufs" type, you can add the partition to the mount operation as follows:
-
Run
gpart show
to locate the first partition that is type "freebsd-ufs" -
Run
mount /dev/<device>p<partition> /yourvol
For example, if gpart show
displays the following:
=> 3 31457269 xbd5 GPT (15G)
3 111 1 freebsd-boot (56K)
114 1600 2 efi (800K)
1714 31455558 3 freebsd-ufs (15G)
then you would mount with:
mount /dev/xbd5p3 /yourvol