What is going on?
df /media/RAMDisk, when it refers to
/dev/sda1, tells you the directory at the moment belongs to the filesystem on
/dev/sda1 which is mounted on
This is because the effect of your
mount command is not permanent, it doesn't survive reboot. On the other hand the
mkdir command created a directory inside the filesystem of
/dev/sda1 and this filesystem is mounted after every reboot so the directory itself survives, but as a part of
You need to mount
RAMDisk after (or at) every boot somehow.
How to mount?
mount from within
.bashrc is not a good idea because this file may be sourced multiple times during a single session. Since you need
sudo anyway, it will be better to use
/etc/rc.local which is run once when OS starts.
But the even better way may be to add the following line to your
tmpfs /media/RAMDisk tmpfs defaults,nosuid,nodev,size=2048M 0 0
noauto options (see
man 5 fstab) and maybe you would like to use them and invoke
mount /media/RAMDisk on demand only.
This site makes me believe you can run a
systemd unit when a given user logs in for the first time and terminate it as soon as the last session for the user is closed. I'm not very familiar with
systemd, so I can't tell you how (if) you can do it with
But if you use
systemd then you should already have a personal
tmpfs mounted on
/run/user/<UID>. The system-wide one should be on
/media/ is used by Ubuntu to create mountpoints e.g. for external USB drives (I believe
udisks2 is responsible). They may look like
/media/<username>/<label> so I guess
/media/RAMDisk is not going to collide with anything. In general I would avoid using this location though. In my systems (Debian, Kubuntu, Raspbian, OpenWRT) I use
/mnt/<something> and I have never had any issues.