Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I want to create a RAM disk - say 8GB. I want to copy SDA1 partition or data to RAM. Then remount / under the 8GB RAM.
I am figuring out how to do this.
-comments
Look at the chroot command. You are trying to do the reverse of what happens when you boot and the root pivots from initrd to the newly mounted root partition.
If you want to run in ram, maybe the best way is to create an initrd file similar to a rescue disk which stays in memory.
I don't see why you want to do this. You will be wasting memory trying to do what caching achieves
at less cost.
as for why - an 4\8GBfilesystem [in RAM] is more than i need for daily use. if files are in RAM and programs load in RAM there is no hard drive-aside from booting-, the computer runs much faster than an array of SSDs.
as for why - an 4\8GBfilesystem [in RAM] is more than i need for daily use. if files are in RAM and programs load in RAM there is no hard drive-aside from booting-, the computer runs much faster than an array of SSDs.
If you say so...
Quote:
its all about performance
Which your solution won't give you. Think about what you're actually doing, and how, and you'll know why.
Quite a bit, apparently. Hardware latency is a small part of the system as a whole.
Read about WHY SSD drives are so expensive, and why (since they've been around for many years), are only now coming to where consumers can afford them, even though RAM is very cheap.
root@nix:~# mount -t tmpfs tmpfs2 /mnt
root@nix:~# mount
/dev/rootvg/lvroot on / type ext4 (rw,relatime,barrier=1,data=ordered)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /boot type ext2 (rw,relatime)
/dev/mapper/rootvg-lvusr on /usr type ext4 (rw,relatime)
/dev/mapper/rootvg-lvopt on /opt type ext4 (rw,relatime)
/dev/mapper/rootvg-lvvar on /var type ext4 (rw,relatime)
/dev/mapper/rootvg-lvtmp on /tmp type ext4 (rw,relatime)
/dev/mapper/rootvg-lvhome on /home type ext4 (rw,relatime)
/dev/mapper/rootvg-lvlocal on /local type ext4 (rw,relatime)
tmpfs on /dev/shm type tmpfs (rw)
tmpfs2 on /mnt type tmpfs (rw)
root@nix:~# dd if=/dev/urandom bs=1048576 count=256 of=/mnt/wibble.data
256+0 records in
256+0 records out
268435456 bytes (268 MB) copied, 33.6394 s, 8.0 MB/s
root@nix:~# cp /mnt/wibble.data /tmp/wibble.data
root@nix:~# sync
root@nix:~# sync
benchmark tmpfs:
Code:
root@nix:~# dd if=/mnt/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.292685 s, 917 MB/s
root@nix:~# dd if=/mnt/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.304778 s, 881 MB/s
root@nix:~# dd if=/mnt/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.299991 s, 895 MB/s
benchmark ext4 on disk:
Code:
root@nix:~# dd if=/tmp/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.276751 s, 970 MB/s
root@nix:~# dd if=/tmp/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.258143 s, 1.0 GB/s
root@nix:~# dd if=/tmp/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.277482 s, 967 MB/s
Reads from ext4 on disk via buffers do appear to be slightly faster than tmpfs in this basic example. Of course, this assumes that the data is already resident and manages to stay in filesystem cache.
I believe that unlike tmpfs, ramfs also goes through the vfs cache, and a test run against a ramfs mounted partition shows comparable results to the on-disk test, which seems to confirm this.
Code:
root@nix:~# dd if=/mnt/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.283992 s, 945 MB/s
root@nix:~# dd if=/mnt/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.264472 s, 1.0 GB/s
root@nix:~# dd if=/mnt/wibble.data of=/dev/null
524288+0 records in
524288+0 records out
268435456 bytes (268 MB) copied, 0.269133 s, 997 MB/s
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.