You are not logged in.

#1 2025-09-13 08:51:39

TooOldForDeInterwebz
Member
Registered: 2025-08-07
Posts: 22

[SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

The last two questions I posted here were down to me not reading things properly. I've since realized it was my (way too tired) eyes causing the problem.

So far everything I needed to know, I could find in the wiki. Often text would magically appear after I'd written a question here and checked the wiki just one more time to be sure before clicking submit.

The following as the first step to create a mountable partition in RAM however, I can't find:

# n=number of drives, x=size in kilobytes
sudo modprobe brd rd_nr=n rd_size=x

Where in the wiki can I read about this?
(EDIT: not the issue with my eyes)

Last edited by TooOldForDeInterwebz (2025-09-15 10:12:00)

Offline

#2 2025-09-13 12:07:19

lmn
Member
Registered: 2021-05-09
Posts: 88
Website

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

I also could not find anything on the wiki related to the brd module.

The official documentation can be found here but an alternative could be tempfs.

Offline

#3 2025-09-13 13:05:14

TooOldForDeInterwebz
Member
Registered: 2025-08-07
Posts: 22

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

I read the page on kernel.org when I first started reading up on the subject in general. It says 3) Using “rdev”, yet the last update from 5 years ago supposedly removed that section. It also does not mention the brd kernel module at all.

With the brd module I can create a mountable ext2  (or any other with mkfs) partion for data that I can use as such. With tempfs I can't.

lmn wrote:

I also could not find anything on the wiki related to the brd module.

As you couldn't find it either, my guess it's not in there.

Last edited by TooOldForDeInterwebz (2025-09-13 13:05:41)

Offline

#4 2025-09-13 15:07:27

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,162

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

modinfo brd

lmn already linked you the relevant https://docs.kernel.org/admin-guide/blo … mdisk.html - which has a likewise brief explanation of the (not very complicated?) parameters.

https://en.wikipedia.org/wiki/XY_problem
What is the actual question you seek answered in the wiki?

With the brd module I can create a mountable ext2  (or any other with mkfs) partion for data that I can use as such. With tempfs I can't.

Yesnosorta.
You can just create an image file in /tmp - different approach, same attitude.

Offline

#5 2025-09-13 17:12:56

TooOldForDeInterwebz
Member
Registered: 2025-08-07
Posts: 22

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

OK... the yesnosorta is what I'm hoping to solve.(where are the IDs?)

I have a couple of photo processing tools for which I need Windows. It's running as a VM with QEMU and virt-manager.

I would like to have a device in RAM that I can use as a shared storage between arch and the Windows VM.

Access does not have to be simultaneous and I do not wish to enable shared memory or use SAMBA(I tried both and they work).

The disk will serve mainly for temporary images as part of focus stacking. I also want to use it to transfer the final images to arch for further processing and storage.

At the moment I am passing through my NTFS data disks from when Windows was my main system as Virtual Disks in Virt Manager using /dev/disk/by-id/...

If possible I want to do the same with a virtual device.

The below is not the solution for the above, but where I am at now and definitely something I will use more of under arch.

I know the following gives me an ext2 partition that I can fill with up to 16GB

sudo modprobe brd rd_nr=1 rd_size=16777216
sudo mkfs /dev/ram0
sudo mount /dev/ram0 /home/username/virtualdiskmnt
sudo chown username /home/username/virtualdiskmnt

I don't know:

  • how to 'undo' the first step

  • why repeating the step does not create /dev/ram1

  • why step 2 gives me a UUID that I can't find anywhere so I can use it to address it

  • why I don't get a UUID when I use mkntfs or makefs.fat in step 2

Last edited by TooOldForDeInterwebz (2025-09-13 17:17:38)

Offline

#6 2025-09-13 19:23:42

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,162

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

1. modprobe -r
2. because you can load the module only once, if you want more devices, increase rd_nr

why step 2 gives me a UUID that I can't find anywhere so I can use it to address it
why I don't get a UUID when I use mkntfs or makefs.fat in step 2

Err… wut?

I would like to have a device in RAM that I can use as a shared storage between arch and the Windows VM.

dd if=/dev/zero of=/tmp/shared1.ext2 count=1M
mkfs.ext2 /tmp/shared1.ext2
mkdir /tmp/shared1.mount
sudo mount /tmp/shared1.ext2 /tmp/shared1.mount
ls /tmp/shared1.mount

You should™ be perfectly able to either access /tmp/shared1.mount or /tmp/shared1.ext2 from  your VM?

At the moment I am passing through my NTFS data disks from when Windows was my main system as Virtual Disks in Virt Manager using /dev/disk/by-id/...

Just use /dev/ram0 or (for the above) /tmp/shared1.ext2 - same thing.

Offline

#7 2025-09-14 09:41:41

TooOldForDeInterwebz
Member
Registered: 2025-08-07
Posts: 22

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

seth wrote:

1. modprobe -r
2. because you can load the module only once, if you want more devices, increase rd_nr

Thank you. (Kernel modules are on my learning list). I wasn't aware that you'd have to set one max size for all of them. Not a problem, but individual limits set directly would be easier.

seth wrote:

why step 2 gives me a UUID that I can't find anywhere so I can use it to address it
why I don't get a UUID when I use mkntfs or makefs.fat in step 2

Err… wut?

Here's what I mean with the UUID.

$ sudo mkfs /dev/ram0
mke2fs 1.47.3 (8-Jul-2025)
Discarding device blocks: done                            
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: 39afd08f-672b-4467-b6ff-e6a7efccab17
Superblock backups stored on blocks: 
32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

How / where would I find it, other than in the output shown above? i.e. I can't find a block device with that ID.

seth wrote:

I would like to have a device in RAM that I can use as a shared storage between arch and the Windows VM.

dd if=/dev/zero of=/tmp/shared1.ext2 count=1M
mkfs.ext2 /tmp/shared1.ext2
mkdir /tmp/shared1.mount
sudo mount /tmp/shared1.ext2 /tmp/shared1.mount
ls /tmp/shared1.mount

You should™ be perfectly able to either access /tmp/shared1.mount or /tmp/shared1.ext2 from  your VM?

At the moment I am passing through my NTFS data disks from when Windows was my main system as Virtual Disks in Virt Manager using /dev/disk/by-id/...

Just use /dev/ram0 or (for the above) /tmp/shared1.ext2 - same thing.

Yes. This is another way. Though I'm only able to use this when the shared memory option is enabled for the VM. Which is where I'm stuck at again now. Figured I should understand the first command I'm using, before looking at the rest to see if I'm on the correct path.

Just like with SAMBA, I do not understand enough about the vulnerabilities of shared memory to be comfortable using these solutions at present. I engage in 'risky behaviour', if I can logically justify it to myself.

I like about SAMBA that I can set it up so you need to know the IP address and user/pwd.

So it's not just about sharing between host and VM, it's about sharing a specific way. Here's an exmple of the relevent XML from the VM for how I passthough an SSD. (NVMEs in their own IOMMU group are passed through as PCI devices like the GPU)

<disk type="block" device="disk">
  <driver name="qemu" type="raw" cache="none" io="native" discard="unmap"/>
  <source dev="/dev/disk/by-id/THE DISK'S ID"/>
  <target dev="vdb" bus="virtio"/>
  <address type="pci" domain="0x0000" bus="0x0b" slot="0x00" function="0x0"/>
</disk>

I want a device in RAM that I can passthrough the same way or similar manner. Access from guest and host does not have to be simultaneous.

Another reason for not using SAMBA for this (which I will use for other purposes later), is the image files for focus stacking. This can result in a couple of GB worth of tif files, which I never need for more than an hour.

Offline

#8 2025-09-14 12:47:21

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,162

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

<source dev="/dev/disk/by-id/THE DISK'S ID"/>

You can just make that

<source dev="/dev/ram0"/>

or

<source dev="/tmp/shared.ext4"/>

There's really nothing special about the disk/by-id access path

Offline

#9 2025-09-15 10:11:11

TooOldForDeInterwebz
Member
Registered: 2025-08-07
Posts: 22

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

Insert faceplam image

As soon as I saw

seth wrote:

...

<source dev="/dev/ram0"/>

...

I realised the error of my ways.

Thank you.

Offline

#10 2025-09-16 10:49:18

TooOldForDeInterwebz
Member
Registered: 2025-08-07
Posts: 22

Re: [SOLVED] Where in the wiki can I find "modprobe brd rd_nr=..."?

My initial question had been answered and I had been provided a solution to proceed tiwards my actual goal.

As the full solution to what my goal was isn't here, just wanted to add what I do now in case anyone else reads the thread.

A solution for a temporary storage in RAM with the conditions I want and need(no shared memory, no SAMBA, does not have to be simultaneous access):

Create device on host. In this case 16GB:

sudo modprobe brd rd_nr=1 rd_size=16777216

Passthrough the device

/dev/ram0

to the Windows VM as a virtual disk using Virt Manager

Launch VM. Format the disk in the Windows VM. Write data. Shut down guest.

setup loopback device on host

losetup -f -P /dev/ram0

In my case it creates loop0 as no others were setup beforehand

mount loopback partition

sudo mount /dev/loop0p2 /pathtomountwhatever

When accessing from a Linux VM, the partition created on the host is available (including any data that has been written to it on the host).

When accessing from a Windows VM, it sees the disk but not the partition (i.e. not possible to access data).

When formatted in the Windows VM, the partition can later only be mounted via loopback device on the host.

If anyone has a different or more elegant solution, I will gladly try it out.

The steps are a result of being guided by error messages and looking for solutions step by step... and the more important part of seth, either knowingly or not, pointing out my lapse of reasoning (see my previous reply).

Offline

Board footer

Powered by FluxBB