LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to backup ramfs or tmpfs using dd (http://www.linuxquestions.org/questions/linux-general-1/how-to-backup-ramfs-or-tmpfs-using-dd-4175422520/)

penyu 08-16-2012 07:50 PM

how to backup ramfs or tmpfs using dd
 
Hi All,

I have problem with backup ramfs/tmpfs to solid/regular disk.

I prefer backup those ramfs/tmpfs using "dd" command instead of "cp" command, so I don't need care about a lot of files, contain of files/dirs and permissions.

as I know backup using dd need two params: origin disk/file and destination disk/file. disk usually identified by something in /dev.

for ramfs/tmpfs I dont know how to dealing with, since I cannot found those type of disk/file under /dev nor dmesg.

Code:

root@debian:/etc# cat /etc/fstab
...........
none    /mnt/tmpfs      tmpfs  size=1G 0      0
root@debian:/etc# mount -a
root@debian:/etc# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1            953M  702M  203M  78% /
tmpfs                1.5G    0  1.5G  0% /lib/init/rw
udev                  1.5G  96K  1.5G  1% /dev
tmpfs                1.5G    0  1.5G  0% /dev/shm
none                  1.0G    0  1.0G  0% /mnt/tmpfs
root@debian:/etc#

do somebody ever had this similar cases?

really appreciated for your kind of answers.
BR//Den

Skaperen 08-17-2012 12:02 AM

ramfs/tmpfs are for ephemeral data. If you need to back it up, you should not be putting it in ramfs/tmpfs. Ordinary filesystems for physical block devices do sufficient caching that you should get near ramfs speed if you have enough free RAM. And they are inherently backed up via their backing store (do "sync" to be sure at given points in time). Let the OS take care of this for you unless you have an odd case (tell us about it, if so).

I have used ramfs or ramdisk in lieu of a disk to avoid the disk I/O in some cases (example: I did a Slackware install in a VM based entirely on a ramdisk in much less time than doing so on a real disk in a real machine). I copied the image to disk afterwards. If it didn't finish, that data was of no value.

penyu 08-17-2012 02:09 AM

well thanks Skaperen,

actually my goal is only during software operations, to speed-up process and data reads, that why I need this method.
but, due to some data may be needed in another operations, I will need those data stored fast.

I prefer doing all that things in memory, rather than physical disc.

any workaround please welcome.. :)

BR//

unSpawn 08-17-2012 05:21 AM

Quote:

Originally Posted by penyu (Post 4756176)
I prefer backup those ramfs/tmpfs using "dd" command instead of "cp" command, so I don't need care about a lot of files, contain of files/dirs and permissions.

As for method, why not use rsync instead? Like
Code:

rsync -rSW /mnt/tmpfs/ /path/to/backup/tmpfs/


All times are GMT -5. The time now is 11:50 PM.