-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zramctl: add page #1307
zramctl: add page #1307
Conversation
zram is a linux kernel module, available since 3.14 and installed by default, that allows you to create virtual disks that are compressed on the fly and stored in ram. While this PR adds a page about it, I don't expect it to be anywhere near perfect at first :P http://karelzak.blogspot.co.uk/2014/08/zramctl.html
@sbrl - Please fix the travis errors :) |
@agnivade Fixed, |
pages/linux/zramctl.md
Outdated
|
||
- Format a zram device to ext4: | ||
|
||
`sudo mkfs.ext4 {{/dev/zram0}}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a zram command. Should this be included ?
pages/linux/zramctl.md
Outdated
|
||
`lsmod | grep -i zram` | ||
|
||
- Enable zram with 2 devices: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "device" mean here exactly ? Trying to understand zram a bit. IIUC, zram allows a sort of extended virtual memory to use RAM further and prevent paging to disk.
So how does "device" play in here. Is it a single zram "partition" / "disk" ? And if so, where is the size specified ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "device" mean here exactly ?
By "device" I meant "linux device".
IIUC, zram allows a sort of extended virtual memory to use RAM further and prevent paging to disk.
Sort of. You can create virtual disks that are stored compressed in RAM, which you can then format as a swap disk with mkswap
. With that you can enable the new swap partition with a higher priority than any other swap partitions you may already have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So how does "device" play in here. Is it a single zram "partition" / "disk" ?
Yep. When enabling zram, you can tell it how many virtual disks (called devices) to create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And if so, where is the size specified ?
Simply creating the disk doesn't initialise it to have a size. You need to use zramctl
to do that
I've written a blog post on it, if it helps :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great clarifications !
pages/linux/zramctl.md
Outdated
|
||
- Initialise the next free zram device to a 2GB virtual drive: | ||
|
||
`sudo zramctl --find --streams {{compression_streams_count}} --size {{2GB}} --algorithm lz4` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lz4 to be in tokens. And also, since you have already given a concrete no. for size, maybe you should also give a concrete no. for "compression_streams_count".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll change that!
@agnivade Updated. |
pages/linux/zramctl.md
Outdated
|
||
- Initialise the next free zram device to a 2GB virtual drive: | ||
|
||
`sudo zramctl --find --streams {{4}} --size {{2GB}} --algorithm lz4` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does "--streams" mean ? Can we add it to the description ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that probably ought to be added to the description. It specifies the number of compression streams that should be attached to the device. I interpret that to be the number of concurrent reads/writes it can handle at once. Either way, I assume you'd want to set it to the number of cpus you have for best performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just not sure now how I'd work that into the description though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take a stab at it when I have some time. Now that I have a clear idea as to what the concepts are.
@sbrl - Made some changes. I removed the last example and added a pointer to that command in the main description. Also, removed the Let me know what you think. |
Yeah, that certainly simplifies it! I've tweaked the description just a bit. |
Please sign the license file and we can look into merging this in... |
@jeeftor I hadn't signed it? Thanks for pointing that out! I thought for sure I'd signed it before. I've signed it again - hopefully that should work :-) |
This is the old license check which somehow came. I am going to force-merge this. |
Yay, thanks :D |
zram is a linux kernel module, available since 3.14 and installed by default, that allows you to create virtual disks that are compressed on the fly and stored in ram.
While this PR adds a page about it, I don't expect it to be anywhere near perfect at first :P
http://karelzak.blogspot.co.uk/2014/08/zramctl.html