Makers Blog Archive

Creating a RAM disk in the AXC F 2152

PLCnext Team 15 February 2019 min. read
256 views 0 comments

The AXC F 2152 has 512 Mb RAM. Of this the OS is using a part of it but there is still a lot which is not used. This free space could be used for a RAM drive. Unlike the SD-Card the RAM drive has no limitations in reading and writing. Therefore it could be very useful for tasks which have a lot of reading and writing, e.g. a Datalogger. The downside of the RAM drive is that everything on it is gone after a restart/reboot of the controller. So it would be a good idea to have a backup solution for the data. 

It is necessary to create a folder where the RAM disk can be mounted. In this example I would like to place it in the /opt/plcnext/ folder. I log on to the controller and create the folder.

$ mkdir ramdisk
mkdir

When the folder is created, it is possible to attach the RAM drive to the folder. To do that a line is added to the file “fstab”. The file is located in the folder /etc. It is only possible to edit the file when you are logged in as “root”

So with this on your terminal "root@axcf2152:/etc#". Write the command 
$ nano fstab

In the nano editor the line with the settings for our RAM drive is now added.

tmpfs                /opt/plcnext/ramdisk tmpfs      defaults,size=20%     0  0
NanoEditor

After the line is added to the file, save it and reboot the controller. After the reboot it is now possible to check that the RAM drive is attached to the folder, and also to see the actual size of it.

ls df

Note:

The Makers Blog shows applications and user stories of community members that are not tested or reviewed by Phoenix Contact. Use them at your own risk.

Discussion

Please login/register to comment

Login/Register

Leave a Reply

Newsletter
Never miss a new article
Sign up for the newsletter
Never miss news about PLCnext Technology
Get interesting content via newsletter four times a year
Receive exclusive information before all other users