How to mount ext4 fs with block size of 65536?

80

Solution 1

AFAIK ext2/3/4 is based on the generic Linux VFS framework which requires block size to be less than or equal to page size

You may experience mounting problems if block size is greater than page size (i.e. 64KiB blocks on a i386 which only has 4KiB memory pages).

https://www.kernel.org/doc/html/latest/filesystems/ext4/overview.html

There were some talks regarding solving the big block issue

Unfortunately there's almost no great progress yet


However since you just want to test the speed, I suggest to use bigalloc which allocates in big clusters instead of big blocks. For example to create an ext4 partition with 64KB cluster

dd if=/dev/zero of=ext4.bigalloc bs=1M count=256
mkfs.ext4 -C 65535 -O bigalloc ext4.bigalloc
sudo mount -o loop ext4.bigalloc /mnt

This option is new in Linux 3.2 kernel and you must specify that option when calling mkfs.ext4 as seen above

  • -C cluster-size
    • Specify the size of cluster in bytes for filesystems using the bigalloc feature. Valid cluster-size values are from 2048 to 256M bytes per cluster. This can only be specified if the bigalloc feature is enabled. (See the ext4 (5) man page for more details about bigalloc.) The default cluster size if bigalloc is enabled is 16 times the block size.

http://manpages.ubuntu.com/manpages/trusty/man8/mke2fs.8.html

This feature is still in development so use it with care. But since you typically don't care about file corruption while benchmarking, it's probably the best option


That said, the limit is just in the in-kernel driver and you can still mount the partition with the FUSE driver. Some examples:

  • Fuse-ext2

    Fuse-ext2 is an EXT2/EXT3/EXT4 filesystem for FUSE, and is built to work with osxfuse.

    Usage:    fuse-ext2 <device|image_file> <mount_point> [-o option[,...]]
    
    Options:  ro, rw+, force, allow_other
              Please see details in the manual.
    
    Example:  fuse-ext2 /dev/sda1 /mnt/sda1
    

    Just run sudo apt install fuseext2 to install if it's not available. Tested on my system and it works perfectly

  • guestmount. See how to use it in Possible to mount an ext4 partition image via FUSE?

If you just want to copy the data then you can use debugfs but it's not quite useful for benchmarking. Even the performance of FUSE may be not good enough for measuring the device speed

Solution 2

The max ext4 block size is still limited by the page size of the kernel/CPU. Your page size is 4K and so the max ext4 block size is 4K.

Share:
80

Related videos on Youtube

Yanni
Author by

Yanni

Updated on September 17, 2022

Comments

  • Yanni
    Yanni over 1 year

    I have started Roaslind, the bioinformatics-teaching platform. I am trying to do the first problem. This is the code that I have ended up with:

    #!/usr/bin/python -tt
    
    def count_nuc():
    
        '''Usage: count_nuc()'''
    
        s = raw_input('Enter nucleotide string: ')
        if s.isalpha():        
            if len(s) < 1000:
                for letter in s:
                    if letter.upper() == 'A':
                        a =  s.count('A')
                    elif letter.upper() == 'C':
                        c =  s.count('C')
                    elif letter.upper() == 'G':
                        g = s.count('G')
                    elif letter.upper() == 'T':
                        t = s.count('T')
                    else:
                        print('Error')
                print '%d %d %d %d' % (a, c, g, t)
            else:
                print('String must be 1000 nucleotides or less.')
                count_nuc()
        else:
            print('String must of nucleotides must only contain alphabetic characters.')
            count_nuc()
    

    It works fine. Mostly. the issue that I am having is kind of silly. I am using the count method for strings to count the number of nucleotides of a specific type, then assigning that number to my variable. However, if no such nucleotide exists (i.e., I give it a string like 'ATGTTT', then my variable 'c' never gets defined and the print statement barfs. I have thought about this and nothing I can think of allows me to get around this. I have thought of trying to check if the variable exists before printing it out, but this seems kind of clumsy to me and am not sure if that would be considered proper coding etiquette.

    • Janne Karila
      Janne Karila almost 10 years
      Note that you are counting all A's for every A in the string, which is rather wasteful.
  • jonrsharpe
    jonrsharpe almost 10 years
    They're counts, so 0 rather than '', but initialising is good.
  • Reloader
    Reloader almost 10 years
    You're welcome :) accepting an answer is appreciated! ;)
  • Yanni
    Yanni almost 10 years
    Thank you for your insightful critique. I have only been doing this about a week so far and have never heard of collections or Counter, but your solution does seem to save a lot of typing. Thank you very much for your kind input to a beginner's query.
  • Siu Ching Pong -Asuka Kenji-
    Siu Ching Pong -Asuka Kenji- over 2 years
    Here is a reference to Bigalloc from Linux Kernel Wiki: ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Bigalloc