Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a lot of photos and am working on them extensively, mainly going quickly through them back and forth via a Photo Browser and also doing some work via scripts.

  • Would that make sense to format a separate partition with larger than 4096 block size (e.g. 64k)?
  • Would my IO operations on the files improve? How?
  • Is it healthy and safe for the HDD with otherwise 512 block size partitions?

Cheers.

share|improve this question
add comment

3 Answers

Would that make sense to format a separate partition with 4096 block size?

Usually yes. It is also the default size used for most filesystems.

Would my IO operations on the files improve? How?

Since you would use the defaults they would not change.

Now if you wanted to format the low level sectors on the disk (and not the way the filesystem on top of those disk blocks is used):

If the disk allows 4KB sector reads you could read 8x more data in a single IO operation. That is not the same as 8x faster, since reading might take longer. It is likely to be somewhat faster though.

Is it healthy and safe for the HDD with otherwise 512 block size partitions?

I suspect that it is neither what you wanted to ask, nor that it is possible with tools which are available to end users.

The closest thing I ever did was low level reformat old IBM mainframe SCSI disks from 520 bytes per sector to 512 bytes per sector. That was the entire disk, including spare sectors.

By now SATA disks use the same trick as those old SCSI disks: When sector reads fails it will try to read the sector a few times. If a re-read works: no big deal. If it happens a few times to the same sector it is assume to fail soon, and a spare sector is used instead. Thi sis all done in the firmware and the end user does not notice this.

Now if you start changing physical sector sizes on the disk then you will also need to rewrite the firmware so it is aware of the different sector sizes and uses the right spares. Technically that is possible, but in praxis you will need factory tools and inside knowledge.

share|improve this answer
    
Thank you, I am sorry, I have altered the question slightly Would that make sense to format a separate partition with larger than 4096 block size (e.g. 64k)? So you are saying if I format a partition to larger block size, the partition won't work? Ah well, I'll wait a bit, but I am quite convinced you are right and I got confused (I thought such thing was possible as to format to larger block so that the head will need less "steps" to read the block) –  catalesia Mar 9 '13 at 14:12
    
Not quite. I am saying that you can format a filesystem on a partition to use a large blocksize, and that that might be a bit faster. But you can not format the (raw) sectors on the disk. And the fdisk listing is about those sectors. –  Hennes Mar 9 '13 at 14:15
add comment

The block size is relevant to read and store files on the Hard disk.

Would that make sense to format a separate partition with larger than 4096 block size (e.g. 64k)?
Depends upon the size of your photographs. If all or at lease most of the files are of a size that are multiples of this or slightly less than multiples of this, it would surely help, otherwise they would just eat up more space.

Would my IO operations on the files improve? How?
If the file-size of a file is in multiples of the block size or again slightly less than the block size, it may help to some extent, since reading and writing is done in blocks, not bytes.

Is it healthy and safe for the HDD with otherwise 512 block size partitions?
I am not aware of any ill-effects caused to the HDD because of change in block size.

share|improve this answer
    
Well, the file sizes vary, but are over 3.5 MB and over 20MB. Still I am willing to sacrifice n MB if for example having 16x bigger cluster (as teppic suggests) opens my photos slightly faster and if the writes to disk are slightly faster. –  catalesia Mar 9 '13 at 15:01
    
I fear @catalesia, that is a great deal of variation, and having dedicated paritions of a particular block-size can hardly make any significant change, I suppose. –  Jobin Mar 9 '13 at 15:29
add comment

I'm assuming you're using ext4. The default is to use a blocksize that has the best performance for the filesystem, and this is usually 4kb already. You can see it by running this command:

$ sudo tune2fs -l <partition device>

There's no problem if the HDD has smaller blocks, it just means more than one underlying block is used by the filesystem.

ext4 is clever about how it uses blocks, so for large files it will not keep going backwards and forwards in single 4kb calls. A larger block size is not directly possible (mkfs.ext4 -b 8192 <device> will not work, for example). There's an undocumented -C option to specify a cluster size, which effectively increases the block size.

share|improve this answer
    
thanks for clarifying that, I don't know why I thought the block size is 512? fdisk -l gave me that impression. Anyways, I shall rephrase the question - what I really mean is will larger block size increase the performance? –  catalesia Mar 9 '13 at 13:58
    
fdisk returns the physical sector size that the disk reports. Not the filesystem block size. –  Hennes Mar 9 '13 at 14:07
    
Old tests on windows (should be more or less the same for Ubuntu) showed that larger cluster sizes (filesystem block size on Ubuntu) speeds up large serial reads. it also has downsized such as wasting space. –  Hennes Mar 9 '13 at 14:09
    
@catalesia: I've updated the answer –  teppic Mar 9 '13 at 14:17
    
@teppic OK, I'm going to read more about that, I wasn't aware that the operation I would have to perform is to increase cluster size. I shall test it too. –  catalesia Mar 9 '13 at 14:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.