1

i want to create a tmpfs file system for one of my vm to run on,using XEN Server.

On the host machine i tried this but is not working,.

xe sr-create device-config:device=/dev/shm name-label="RAM" type=tmpfs

Is it possible to make a tmpfs file system using xe command and make the vm run on it rather on HDD.This VM should not be slowed down by waiting for disks(This is what required).Can this be achieved using XEN server.Is there a better way of doing it? This host is having only a single HDD and can not afford to add extra storage.

2 Answers 2

6

I'm guessing here, but tmpfs generates a filesystem. SR's are block devices. You could probably create an empty file on the tmpfs, run losetup on it, and use that as your block device on tmpfs.

Edit: I just did a quick test:

dd if=/dev/zero out=/dev/shm/testing bs=4M count=100
losetup /dev/loop0 /dev/shm/testing
parted /dev/loop0 mklabel msdos
parted /dev/loop0 mkpart 1 primary ext2 0% 100%
pvcreate /dev/loop0

At this moment you can make it into a part of your LVM, so you should be able to put images on it.

1
  • this is the best ever answer i have ever got from questions i have asked in server fault.i thought i will not get an answer for this question.I couldnt believe my eyes when i see a local storage named RAM in my storage.Thank you very much. to add a few.. parted command was not there,used fdisk instead. Aug 15, 2012 at 13:57
0

Full steps

dd if=/dev/zero out=/dev/shm/testing bs=4M count=100

losetup /dev/loop0 /dev/shm/testing

fdisk /dev/loop0

mkfs.ext4 /dev/loop0

pvcreate /dev/loop0

xe sr-create device-config:device=/dev/loop0 name-label="RAM" type=ext4

go to xen-centre and refresh storage.

1
  • Did you notice a significant speedup on Virtual Machines stored on this ramdisk? Care to share a startup and shutdown script that moves the vdi from and back to a nonvolatile storage repository?
    – rjt
    Jan 4, 2020 at 23:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .