Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8093891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:36:54+00:00 2026-06-05T20:36:54+00:00

I have an embedded device where i need to put my /var and /tmp

  • 0

I have an embedded device where i need to put my /var and /tmp in ram in order to diminish the number of writes on the drive (Compact flash). I know how to do it with /tmp as i don’t have to recover anything whenever i reboot or shutdown.

But the /var directory has important stuff. I have been researching and i found this, but it doesn’t seem to be working.

Here is the script:

# insert this on file 'rc.sys.init'
# after the mount of the root file system
# to create the /var on ramdisk


echo "Create ramdisk........."
#dd if=/dev/zero of=/dev/ram0 bs=1k count=16384
mkfs.ext2 -j -m 0 -q -L ramdisk /dev/ram0
if [ ! -d /mnt/ramdisk ]; then
     mkdir -p /mnt/ramdisk
fi
mount /dev/ram0 /mnt/ramdisk
if [ -L /var ]; then
     tar -xf /vartmp.tar -C /mnt/ramdisk
else
    tar -C / -cf /vartmp.tar var
    cp -a /var /mnt/ramdisk
    rm -rf /var
    ln -s /mnt/ramdisk/var /var
fi  

# insert this into file 'halt'
# to stop the ram disk properly on shutdown.
#

if [ -e /vartmp.tar ]; then
     rm -f /vartmp.tar
fi;
tar -C /mnt/ramdisk -cf /vartmp.tar var

Is there any problem with this script? If not, in which inicialization and termination script should i include them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T20:36:55+00:00Added an answer on June 5, 2026 at 8:36 pm

    For all that have the same problem i do i have solved my problem (kind of)

    The two scripts i posted are correct and accomplish the job. What you have to be careful is where you put them.

    In Slackware the first run script is rc.S. At first i copy pasted my first script into the middle of that one. It definitely should be there, just not where i put it. You have to see where does the script rc.S call for a particular directory or file from /var. The creation of the ramdisk should be before those lines.

    the shutdown script should be added in the bottom of the rc.6 script (shutdown script)

    Also i should point out that although this improves the life expectancy of the drive, it is a little volatile and sometimes randomly reboots, so be careful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an embedded device,its includes windows CE 6.0 Build 3112.I want to run
I have an embedded device communicatiing with a host (with Tera Term) through USART.
I have an embedded device running busybox . The device has crond installed and
I have a ARMv5-powered non-XScale device (the SHARP Brain™ electronic dictionary) with Windows Embedded
I have an unusual situation - I have an embedded video streaming device with
I need an emulator for Windows CE 5.0 to test an embedded device (not
I need to write an user menu for an embedded device (mips linux). The
I have an 8 digit hexadecimal number of which I need certain digits to
I have ASP.NET server. I have an embedded device with cellular communication (socket based)
I have a sealed Windows XP embedded device which always boots up with the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.