Skip to content
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

Merged
merged 6 commits into from
Apr 7, 2017
Merged

zramctl: add page #1307

merged 6 commits into from
Apr 7, 2017

Conversation

sbrl
Copy link
Member

@sbrl sbrl commented Mar 24, 2017

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

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
@agnivade agnivade added the new command Issues requesting creation of a new page. label Mar 24, 2017
@agnivade
Copy link
Member

@sbrl - Please fix the travis errors :)

@sbrl
Copy link
Member Author

sbrl commented Mar 25, 2017

@agnivade Fixed, I think :D


- Format a zram device to ext4:

`sudo mkfs.ext4 {{/dev/zram0}}`
Copy link
Member

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 ?


`lsmod | grep -i zram`

- Enable zram with 2 devices:
Copy link
Member

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 ?

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member Author

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 :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great clarifications !


- Initialise the next free zram device to a 2GB virtual drive:

`sudo zramctl --find --streams {{compression_streams_count}} --size {{2GB}} --algorithm lz4`
Copy link
Member

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".

Copy link
Member Author

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 agnivade changed the title Create zramctl.md zramctl: add page Mar 31, 2017
@sbrl
Copy link
Member Author

sbrl commented Mar 31, 2017

@agnivade Updated.

@sbrl sbrl mentioned this pull request Mar 31, 2017

- Initialise the next free zram device to a 2GB virtual drive:

`sudo zramctl --find --streams {{4}} --size {{2GB}} --algorithm lz4`
Copy link
Member

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 ?

Copy link
Member Author

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.

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestions?

Copy link
Member

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.

@agnivade
Copy link
Member

agnivade commented Apr 3, 2017

@sbrl - Made some changes. I removed the last example and added a pointer to that command in the main description. Also, removed the --streams option as I think this is too complicated to be mentioned in a tldr example.

Let me know what you think.

@sbrl
Copy link
Member Author

sbrl commented Apr 5, 2017

Yeah, that certainly simplifies it! I've tweaked the description just a bit.

@jeeftor
Copy link
Collaborator

jeeftor commented Apr 6, 2017

Please sign the license file and we can look into merging this in...

@sbrl
Copy link
Member Author

sbrl commented Apr 6, 2017

@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 :-)

@agnivade
Copy link
Member

agnivade commented Apr 7, 2017

This is the old license check which somehow came. I am going to force-merge this.

@agnivade agnivade merged commit 9059d62 into tldr-pages:master Apr 7, 2017
@sbrl
Copy link
Member Author

sbrl commented Apr 7, 2017

Yay, thanks :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new command Issues requesting creation of a new page.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants