The following commands are how I create a RAMDisk on Ubuntu 12.04 LTS:

sudo mkdir -p /media/ramdisk
sudo mount -t tmpfs -o size=1024M tmpfs /media/ramdisk

But now I have no idea to eject it.

These commands are what I've tried but not work:

sudo eject /media/ramdisk
sudo umount /media/ramdisk

How to eject RAMDisk properly?

closed as unclear what you're asking by psusi, user117103, falconer, Maythux, Avinash Raj Feb 14 '14 at 9:19

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    Define "don't work". – psusi Feb 13 '14 at 1:20

The inverse of sudo mount -t tmpfs tmpfs /media/ramdisk is sudo umount /media/ramdisk.

The last command will only succeed if no application is using /media/ramdisk though. You can use sudo lsof -n /media/ramdisk to find out which programs are blocking the mount point.

  • Well, it popped up this warning: lsof: WARNING: can't stat() fuse.gvfs-fuse-daemon file system /home/username/.gvfs Output information may be incomplete. – Kevin Dong Feb 12 '14 at 11:23
  • 2
    That's non-fatal, what make you think that /media/ramdisk has not been unmounted? What does mountpoint /media/ramdisk tell you? By the way, "unmounting" leaves the directory behind, so you still have to remove the directory after unmounting: sudo rmdir /media/ramdisk – Lekensteyn Feb 12 '14 at 11:40

Not the answer you're looking for? Browse other questions tagged or ask your own question.