LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Block Sizes (https://www.linuxquestions.org/questions/linux-newbie-8/block-sizes-4175476724/)

billvance 09-11-2013 09:59 AM

Block Sizes
 
Howdy;
I'm trying to find out how to do appropriate block sizes for
quota and dd. Near as I've been able to find out, dvd-r uses
a block size of 2048, and has a total of 4044128 blocks.

However, when I try to do the math, it comes out to 8282374144
bytes, and when I try to divide it up to get something that
seems reasonable for the two mentioned programs, and then check
the math by multiplying back up, the numbers all come out
different. Can anyone tell me what the appropriate numbers are?

Bill

qrange 09-11-2013 03:57 PM

that seems like a dual layer disc?
why not simply use bs=2048 in dd ?

I don't understand how numbers can be different, unless you're using Pentium I :)

billvance 09-11-2013 10:23 PM

I don't understand it either. According to one source, dd
is supposed to create a file of n length composed of all
zeros, n being the size of the virtual file thats the same
size as the dvd-r. At least thats what they seemed to be
saying.

qrange 09-12-2013 01:30 AM

well it can do that. what options are you using?

you could use it like this:

dd if=/dev/zero of=file_composed_of_zeros bs=2048 count=4044128

or

dd if=/dev/zero of=file_composed_of_zeros bs=16384 count=505516

result should be the same. but the latter might be a bit faster.

maybe you forgot the 'count' option when reading from dvd.
various dvd drives can add some zeroes to end of .iso file, so you get slightly wrong result. just truncate it to N*2048.

billvance 09-12-2013 07:51 AM

Thanks, that was the part that wasn't explained.

Now, for the second part of my question, how does one do
that for quota? Or would lat-quota be easier? I only just found out about lat-quota, so I haven't even had a chance
to go over the man page yet.

billvance 09-13-2013 03:57 AM

Perhaps I should rephrase the question a bit.
I've been all over the web looking, but all
I've found, is that its relatively easy to
set the number of blocks in quota. What I
haven't been able to find, is how to set the
size of those blocks, or even if quota has
some default block size that it insists on
using. Anyone got a clue on that?

qrange 09-13-2013 04:05 PM

I don't know, never used quota. my guess is it would be equal to size of filesystem blocks. you set that when you format partition. I think its usually 4K.
might be a good idea to have larger blocks if partition is to hold mostly huge files.

I just checked, seems it is so: http://www.cyberciti.biz/tips/determ...isk-quota.html

jpollard 09-13-2013 05:34 PM

Quote:

Originally Posted by billvance (Post 5026990)
Perhaps I should rephrase the question a bit.
I've been all over the web looking, but all
I've found, is that its relatively easy to
set the number of blocks in quota. What I
haven't been able to find, is how to set the
size of those blocks, or even if quota has
some default block size that it insists on
using. Anyone got a clue on that?

Disk quotas are computed using the size of the minimum allocation unit of the disk (a block). If your disk uses 2048 byte blocks, then that is the size it will use. If the disk is 4k byte blocks then that is the size it uses.

qrange 09-14-2013 03:37 AM

iirc, 'physical' block size on *all* disks is 512 bytes. this seems to be logical block size.
if so, its a bit confusing, what happens when you have several mount points with different logical block size?

jpollard 09-14-2013 08:21 AM

Quote:

Originally Posted by qrange (Post 5027504)
iirc, 'physical' block size on *all* disks is 512 bytes. this seems to be logical block size.
if so, its a bit confusing, what happens when you have several mount points with different logical block size?

That used to be true, but isn't anymore. Some of the 4TB disks use 4k blocks instead, and emulate (at a performance penalty) a 512 byte block if they are configured to do so.

Each filesystem has the minimum allocation unit in its header, and that is what is used.

Each filesystem mounted has to be given its own quota allocation. Where it is mounted doesn't matter. Now that said, SOME filesystems don't support quotas - FAT/VFAT don't support quotas, NTFS looks like it does, Ext2/3/4 and btrfs do. Memory resident filesystems tmpfs/ramfs do not (and tmpfs introduce a denial of service attack area with the ability to cause OOM when users can access that filesystem).

It looks like CD/DVD formats do not (iso9660, UDF).

qrange 09-14-2013 10:35 AM

if you're refering to 'advanced format', it has been used on many modern drives, not just 4Tb. but, I doubt you can turn off that 512 byte emulation.
it would be nice though, because of 2Tb limit and other things.

billvance 09-16-2013 02:39 AM

Just for the record, here's how I found what
size blocks my hard drive uses:

blockdev --getbsz /dev/sdb5
4096

So it has 4K blocks. Took a while to dig up
what would work, but it does it quickly.

Bill


All times are GMT -5. The time now is 08:15 PM.