Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

75%
+4 −0
Q&A Can I make a compressed RAM drive and externally prepare a (pre-)compressed file to copy onto it?

Linux does have the concept of a RAM DRIVE (multiple concepts actually, including ramfs and tmpfs being common). You should look at https://en.wikipedia.org/wiki/Zram - ZRAM claims to be exactly ...

posted 8mo ago by davidgo‭

Answer
#1: Initial revision by user avatar davidgo‭ · 2023-08-19T06:40:35Z (8 months ago)
Linux does have the concept of a RAM DRIVE (multiple concepts actually, including ramfs and tmpfs being common).   You should look at https://en.wikipedia.org/wiki/Zram - ZRAM claims to be exactly what you are looking for - ie a compressed block device in RAM.

That said, You may be "doing it wrong".

Linux makes strong use of pipes - so if I have an uncompressed file and I want to compress it and ship it to another system - which sounds like what you want - I would use pipes to do it.

Assuming you can SSH into the target machine you can do something like -
 
      tar -czf - /path/to/files/to/compress | ssh user@target "cat > file.tgz"

The above will tar the appropriate files, pipe them to the remote system and dump it in a file called file.tgz.     The "-" in the tar command means write to stdout which is then piped to ssh and dumped on the remote system.

There are lots of options and variants to the above.  You could, for example, use zcat instead of tar to stream a single file, and you could also automatically extract the file on the remote side by replacing the cat command with something to extract the tgz file.