Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am on a Ubuntu machine.

I have make a directory under root directory, by:

$ sudo mkdir /hello
$ sudo mkdir /hello/bye

Then I mount tmpfs with size 1024M to /hello/bye by:

$ sudo echo "tmpfs   /hello/bye   tmpfs   size=1024M,mode=0777  0  0" >> /etc/fstab
$ sudo mount -a

In future , How to clear /hello/bye (tmpfs) ?

share|improve this question
1  
What is mean "to clrear" ? –  Hanan N. Dec 1 '11 at 11:51
2  
don't forget to mention that you asked the same thing here... –  glglgl Dec 1 '11 at 12:25
add comment

2 Answers 2

up vote 3 down vote accepted

If by clear you mean delete all files in there, it's like any other directory:

rm -rf /hello/bye/*

If you mean unmount the tmpfs partition simply do:

umount /hello/bye

Having put the line

tmpfs   /hello/bye   tmpfs   size=1024M,mode=0777  0  0

in your /etc/fstab, that partition will be automatically mounted at every boot. If you don't want to automout use the noauto option:

tmpfs   /hello/bye   tmpfs   size=1024M,mode=0777,noauto  0  0

If you don't need the partition any more, simply delete that line from /etc/fstab and delete the directory /hello/bye.

share|improve this answer
add comment

If its like mounting a clean partition everytime the machine reboots with no content in it. I would suggest to use ramfs. It will be faster since its in physical memory, can treat it as any other mounted accessible filesystem but would go away every time the machine reboots.

# mkfs -q /dev/ram1 8192
# mkdir -p /ramcache
# mount /dev/ram1 /ramcache
# df -H | grep ramcache
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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