Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Change block size on tmpfs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
Sheri255
n00b
n00b


Joined: 15 Apr 2006
Posts: 29

PostPosted: Fri May 04, 2007 3:30 pm    Post subject: Change block size on tmpfs Reply with quote

I'm using sessions on a tmpfs drive, and I see that my files are 4 KiB in size, although none of them are bigger then 100 bytes, so my question is, is it possible to change the block size of the tmpfs mountpoint to about 128-256 bytes instead, so that i can save (lots of) space there?

edit: Problem (kind of) solved. I had a security script that saved everybodies IP in sessions, to make sure they weren't hijacked. I changed the scripts so that the IP was only to be saved if there were other data in the session. Empty files doesn't fill a block, still, i loose 3.9 KiB on every logged in person, so I'd be happy for a better solution. (changing block size)
Back to top
View user's profile Send private message
moondog
n00b
n00b


Joined: 24 May 2007
Posts: 1

PostPosted: Thu May 24, 2007 4:45 pm    Post subject: Reply with quote

This may be way too much work to accomplish what you wish, but would this work for you?

Make a directory for your tmpfs
Code:
mkdir /mnt/tmpfs


Make a small tmpfs for testing
Code:
mount -t tmpfs tmpfs -o size=100M


Create a blank file which uses this space. You could probably use a better bs and count so that it doesn't waste as much space 1M.
Code:
dd if=/dev/zero of=/mnt/tmpfs/fs.img bs=1M count=99


Associate a loop device with our fs.img file
Code:
losetup /dev/loop7 /mnt/tmpfs/fs.img


Apply your file system to your loop device. In this example I chose ext2 with a 1K block size but you could use any fs really.
Code:
mke2fs -b 1024 /dev/loop7


Create a directory to mount the filesystem on our loop device
Code:
mkdir /mnt/ext2


Mount our loop device
Code:
mount /dev/loop7 /mnt/ext2


It shouldn't matter what the block size of /mnt/tmpfs is as it is used by one fs.img container file.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum