Brad Fitzpatrick (brad) wrote in linux,
Brad Fitzpatrick
brad
linux

Big RAM block device

I need to make a 1G block device in memory. (the machine has 4 GB of memory)

Never having done this before, I found rd.o from the block devices section of the kernel config. Did a bit of reading. Was able to make 1 MB, 10 MB, and 100 MB devices (modprobe rd rd_size=1kblocks), and then dd /dev/zero onto them, and then make a filesystem and mount it. No problem.

BUT... when I try to make a 1 GB ram disk, I kill the machine, or some of it:

RAMDISK driver initialized: 16 RAM disks of 1000000K size 1024 blocksize
garrison:~# dd if=/dev/zero of=/dev/ram1 count=2000000
Connection to garrison closed by remote host.
Connection to garrison closed.

lj@mayor:~$ ping garrison
PING garrison.lj (10.0.0.21): 56 data bytes
64 bytes from 10.0.0.21: icmp_seq=0 ttl=255 time=0.2 ms
64 bytes from 10.0.0.21: icmp_seq=1 ttl=255 time=0.1 ms

lj@mayor:~$ ssh root@garrison
ssh: connect to address 10.0.0.21 port 22: Connection refused

I imagine I just killed the VM, trying to allocate all that memory so fast from the buffer cache, which is already mostly in use. I looked through rd.c, but couldn't see anything to suggest a max size.

Ideas?
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 1 comment