How can I create an ext4 ramdisk?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












First, I have create the directory that I will want to mount to.



mkdir /mnt/ramdisk



Now, I could easily turn this into a ramdisk using ramfs or tmpfs via



mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk



I've found a tutorial on how to create a ramdisk which breaks this syntax down as:



mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]



The tutorial indicates that I can replace [FSTYPE] with ext4 to change the FS to ext4. However, I am not convinced this method is correct and that the author has misjudged what changing the [FSTYPE] argument actually does.



UPDATE: For those interested, G-Man and Johan Myréen have weighed in on my speculations about [FSTYPE]. Essentially, the [FSTYPE] argument acts as a necessary (but ignored) placeholder used by mount. See this post's comments for more details.



I would like to know the proper way to create an ext4 ramdisk. That is, I want a temporary directory in memory that uses the ext4 file system. How can this be achieved?







share|improve this question


















  • 1




    The RAM disk block device might be more appropriate...
    – Stephen Kitt
    Oct 29 '17 at 22:59






  • 1




    Good point!  It might not be clear (since James Coyle made no effort to explain it) that the command mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk consists of five pieces: mount, -t tmpfs, -o size=512m, tmpfs and /mnt/ramdisk — the second tmpfs doesn’t go with the -o.  And the basic mount syntax is mount device  dir,  … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:30







  • 1




    (Cont’d) …  so you’re right — the penultimate argument isn’t really [FSTYPE], but rather device (i.e., the analog of /dev/sda1).  And, according to How to correctly mount a tmpfs?, when you have -t tmpfs, the device is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported by df).  (I suspect the same is true for -t ramfs.)  So I agree with you that James Coyle’s tutorial is misleading. … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:33







  • 1




    (Cont’d) …  Which makes me all the more confident that it’s impossible to specify a filesystem type for a RAM disk. … … … … … … … … … … … … … … … … … …  Additional interesting note: mount(8) says that -o size=512m is valid only with -t tmpfs, and is ignored for ramfs).
    – G-Man
    Oct 29 '17 at 23:35







  • 1




    The FSTYPE field must be present to get enough command parameters so that the mount program interprets we are doing a "manual" mount, i.e. it should not look up /mnt/ramdisk in /etc/fstab. It can be anything, and the value is ignored for tmpfs.
    – Johan Myréen
    Oct 30 '17 at 0:35














up vote
1
down vote

favorite












First, I have create the directory that I will want to mount to.



mkdir /mnt/ramdisk



Now, I could easily turn this into a ramdisk using ramfs or tmpfs via



mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk



I've found a tutorial on how to create a ramdisk which breaks this syntax down as:



mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]



The tutorial indicates that I can replace [FSTYPE] with ext4 to change the FS to ext4. However, I am not convinced this method is correct and that the author has misjudged what changing the [FSTYPE] argument actually does.



UPDATE: For those interested, G-Man and Johan Myréen have weighed in on my speculations about [FSTYPE]. Essentially, the [FSTYPE] argument acts as a necessary (but ignored) placeholder used by mount. See this post's comments for more details.



I would like to know the proper way to create an ext4 ramdisk. That is, I want a temporary directory in memory that uses the ext4 file system. How can this be achieved?







share|improve this question


















  • 1




    The RAM disk block device might be more appropriate...
    – Stephen Kitt
    Oct 29 '17 at 22:59






  • 1




    Good point!  It might not be clear (since James Coyle made no effort to explain it) that the command mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk consists of five pieces: mount, -t tmpfs, -o size=512m, tmpfs and /mnt/ramdisk — the second tmpfs doesn’t go with the -o.  And the basic mount syntax is mount device  dir,  … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:30







  • 1




    (Cont’d) …  so you’re right — the penultimate argument isn’t really [FSTYPE], but rather device (i.e., the analog of /dev/sda1).  And, according to How to correctly mount a tmpfs?, when you have -t tmpfs, the device is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported by df).  (I suspect the same is true for -t ramfs.)  So I agree with you that James Coyle’s tutorial is misleading. … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:33







  • 1




    (Cont’d) …  Which makes me all the more confident that it’s impossible to specify a filesystem type for a RAM disk. … … … … … … … … … … … … … … … … … …  Additional interesting note: mount(8) says that -o size=512m is valid only with -t tmpfs, and is ignored for ramfs).
    – G-Man
    Oct 29 '17 at 23:35







  • 1




    The FSTYPE field must be present to get enough command parameters so that the mount program interprets we are doing a "manual" mount, i.e. it should not look up /mnt/ramdisk in /etc/fstab. It can be anything, and the value is ignored for tmpfs.
    – Johan Myréen
    Oct 30 '17 at 0:35












up vote
1
down vote

favorite









up vote
1
down vote

favorite











First, I have create the directory that I will want to mount to.



mkdir /mnt/ramdisk



Now, I could easily turn this into a ramdisk using ramfs or tmpfs via



mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk



I've found a tutorial on how to create a ramdisk which breaks this syntax down as:



mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]



The tutorial indicates that I can replace [FSTYPE] with ext4 to change the FS to ext4. However, I am not convinced this method is correct and that the author has misjudged what changing the [FSTYPE] argument actually does.



UPDATE: For those interested, G-Man and Johan Myréen have weighed in on my speculations about [FSTYPE]. Essentially, the [FSTYPE] argument acts as a necessary (but ignored) placeholder used by mount. See this post's comments for more details.



I would like to know the proper way to create an ext4 ramdisk. That is, I want a temporary directory in memory that uses the ext4 file system. How can this be achieved?







share|improve this question














First, I have create the directory that I will want to mount to.



mkdir /mnt/ramdisk



Now, I could easily turn this into a ramdisk using ramfs or tmpfs via



mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk



I've found a tutorial on how to create a ramdisk which breaks this syntax down as:



mount -t [TYPE] -o size=[SIZE] [FSTYPE] [MOUNTPOINT]



The tutorial indicates that I can replace [FSTYPE] with ext4 to change the FS to ext4. However, I am not convinced this method is correct and that the author has misjudged what changing the [FSTYPE] argument actually does.



UPDATE: For those interested, G-Man and Johan Myréen have weighed in on my speculations about [FSTYPE]. Essentially, the [FSTYPE] argument acts as a necessary (but ignored) placeholder used by mount. See this post's comments for more details.



I would like to know the proper way to create an ext4 ramdisk. That is, I want a temporary directory in memory that uses the ext4 file system. How can this be achieved?









share|improve this question













share|improve this question




share|improve this question








edited Oct 30 '17 at 3:32

























asked Oct 29 '17 at 21:19









buratino

1317




1317







  • 1




    The RAM disk block device might be more appropriate...
    – Stephen Kitt
    Oct 29 '17 at 22:59






  • 1




    Good point!  It might not be clear (since James Coyle made no effort to explain it) that the command mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk consists of five pieces: mount, -t tmpfs, -o size=512m, tmpfs and /mnt/ramdisk — the second tmpfs doesn’t go with the -o.  And the basic mount syntax is mount device  dir,  … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:30







  • 1




    (Cont’d) …  so you’re right — the penultimate argument isn’t really [FSTYPE], but rather device (i.e., the analog of /dev/sda1).  And, according to How to correctly mount a tmpfs?, when you have -t tmpfs, the device is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported by df).  (I suspect the same is true for -t ramfs.)  So I agree with you that James Coyle’s tutorial is misleading. … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:33







  • 1




    (Cont’d) …  Which makes me all the more confident that it’s impossible to specify a filesystem type for a RAM disk. … … … … … … … … … … … … … … … … … …  Additional interesting note: mount(8) says that -o size=512m is valid only with -t tmpfs, and is ignored for ramfs).
    – G-Man
    Oct 29 '17 at 23:35







  • 1




    The FSTYPE field must be present to get enough command parameters so that the mount program interprets we are doing a "manual" mount, i.e. it should not look up /mnt/ramdisk in /etc/fstab. It can be anything, and the value is ignored for tmpfs.
    – Johan Myréen
    Oct 30 '17 at 0:35












  • 1




    The RAM disk block device might be more appropriate...
    – Stephen Kitt
    Oct 29 '17 at 22:59






  • 1




    Good point!  It might not be clear (since James Coyle made no effort to explain it) that the command mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk consists of five pieces: mount, -t tmpfs, -o size=512m, tmpfs and /mnt/ramdisk — the second tmpfs doesn’t go with the -o.  And the basic mount syntax is mount device  dir,  … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:30







  • 1




    (Cont’d) …  so you’re right — the penultimate argument isn’t really [FSTYPE], but rather device (i.e., the analog of /dev/sda1).  And, according to How to correctly mount a tmpfs?, when you have -t tmpfs, the device is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported by df).  (I suspect the same is true for -t ramfs.)  So I agree with you that James Coyle’s tutorial is misleading. … (Cont’d)
    – G-Man
    Oct 29 '17 at 23:33







  • 1




    (Cont’d) …  Which makes me all the more confident that it’s impossible to specify a filesystem type for a RAM disk. … … … … … … … … … … … … … … … … … …  Additional interesting note: mount(8) says that -o size=512m is valid only with -t tmpfs, and is ignored for ramfs).
    – G-Man
    Oct 29 '17 at 23:35







  • 1




    The FSTYPE field must be present to get enough command parameters so that the mount program interprets we are doing a "manual" mount, i.e. it should not look up /mnt/ramdisk in /etc/fstab. It can be anything, and the value is ignored for tmpfs.
    – Johan Myréen
    Oct 30 '17 at 0:35







1




1




The RAM disk block device might be more appropriate...
– Stephen Kitt
Oct 29 '17 at 22:59




The RAM disk block device might be more appropriate...
– Stephen Kitt
Oct 29 '17 at 22:59




1




1




Good point!  It might not be clear (since James Coyle made no effort to explain it) that the command mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk consists of five pieces: mount, -t tmpfs, -o size=512m, tmpfs and /mnt/ramdisk — the second tmpfs doesn’t go with the -o.  And the basic mount syntax is mount device  dir,  … (Cont’d)
– G-Man
Oct 29 '17 at 23:30





Good point!  It might not be clear (since James Coyle made no effort to explain it) that the command mount -t tmpfs -o size=512m tmpfs /mnt/ramdisk consists of five pieces: mount, -t tmpfs, -o size=512m, tmpfs and /mnt/ramdisk — the second tmpfs doesn’t go with the -o.  And the basic mount syntax is mount device  dir,  … (Cont’d)
– G-Man
Oct 29 '17 at 23:30





1




1




(Cont’d) …  so you’re right — the penultimate argument isn’t really [FSTYPE], but rather device (i.e., the analog of /dev/sda1).  And, according to How to correctly mount a tmpfs?, when you have -t tmpfs, the device is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported by df).  (I suspect the same is true for -t ramfs.)  So I agree with you that James Coyle’s tutorial is misleading. … (Cont’d)
– G-Man
Oct 29 '17 at 23:33





(Cont’d) …  so you’re right — the penultimate argument isn’t really [FSTYPE], but rather device (i.e., the analog of /dev/sda1).  And, according to How to correctly mount a tmpfs?, when you have -t tmpfs, the device is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported by df).  (I suspect the same is true for -t ramfs.)  So I agree with you that James Coyle’s tutorial is misleading. … (Cont’d)
– G-Man
Oct 29 '17 at 23:33





1




1




(Cont’d) …  Which makes me all the more confident that it’s impossible to specify a filesystem type for a RAM disk. … … … … … … … … … … … … … … … … … …  Additional interesting note: mount(8) says that -o size=512m is valid only with -t tmpfs, and is ignored for ramfs).
– G-Man
Oct 29 '17 at 23:35





(Cont’d) …  Which makes me all the more confident that it’s impossible to specify a filesystem type for a RAM disk. … … … … … … … … … … … … … … … … … …  Additional interesting note: mount(8) says that -o size=512m is valid only with -t tmpfs, and is ignored for ramfs).
– G-Man
Oct 29 '17 at 23:35





1




1




The FSTYPE field must be present to get enough command parameters so that the mount program interprets we are doing a "manual" mount, i.e. it should not look up /mnt/ramdisk in /etc/fstab. It can be anything, and the value is ignored for tmpfs.
– Johan Myréen
Oct 30 '17 at 0:35




The FSTYPE field must be present to get enough command parameters so that the mount program interprets we are doing a "manual" mount, i.e. it should not look up /mnt/ramdisk in /etc/fstab. It can be anything, and the value is ignored for tmpfs.
– Johan Myréen
Oct 30 '17 at 0:35










2 Answers
2






active

oldest

votes

















up vote
2
down vote













mkdir /mnt/ramdisk
mount -t ramfs ramfs /mnt/ramdisk
dd if=/dev/zero of=/mnt/ramdisk/ext4.image bs=1M count=512
mkfs.ext4 /mnt/ramdisk/ext4.image
mkdir /mnt/ext4ramdisk
mount -o loop /mnt/ramdisk/ext4.image /mnt/ext4ramdisk


But remember, ext4 was not designed to use in ram! tmpfs and ramfs are always better choice in ram than any disk-based filesystem.






share|improve this answer




















  • I am aware that tmpfs and ramfs are better choices to be used in ram. Could you please clarify exactly what is happening the the last three lines of your answer? Also, if I were to use your solution, how can I verify that /mnt/ext4ramdisk is indeed using ext4?
    – buratino
    Oct 29 '17 at 21:46






  • 1




    The last lines create 1. a big file filled with zeroes on the ramfs, 2. creates an Ext4 filesystem using the file as storage, 3. creates the directory /mnt/ext4ramdisk outside the ramfs, 4. loop mounts the image file on /mnt/ext4ramdisk.
    – Johan Myréen
    Oct 30 '17 at 2:44

















up vote
2
down vote



accepted










I have combined an idea given to me by Ipor Sircer's answer with Stephen Kitt's suggestion of using a RAM disk block device.



First, I compiled CONFIG_BLK_DEV_RAM into my kernel. I changed the default number of RAM disks from 16 to 8 (BLK_DEV_RAM_COUNT), though that is based on preference and not necessity.



Next, I created the folder I want to mount to.



mkdir /mnt/ext4ramdisk



Finally, I formatted my RAM disk block device with ext4 and mounted it.



mkfs.ext4 /dev/ram0
mount -t ext4 /dev/ram0 /mnt/ext4ramdisk





share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401295%2fhow-can-i-create-an-ext4-ramdisk%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    mkdir /mnt/ramdisk
    mount -t ramfs ramfs /mnt/ramdisk
    dd if=/dev/zero of=/mnt/ramdisk/ext4.image bs=1M count=512
    mkfs.ext4 /mnt/ramdisk/ext4.image
    mkdir /mnt/ext4ramdisk
    mount -o loop /mnt/ramdisk/ext4.image /mnt/ext4ramdisk


    But remember, ext4 was not designed to use in ram! tmpfs and ramfs are always better choice in ram than any disk-based filesystem.






    share|improve this answer




















    • I am aware that tmpfs and ramfs are better choices to be used in ram. Could you please clarify exactly what is happening the the last three lines of your answer? Also, if I were to use your solution, how can I verify that /mnt/ext4ramdisk is indeed using ext4?
      – buratino
      Oct 29 '17 at 21:46






    • 1




      The last lines create 1. a big file filled with zeroes on the ramfs, 2. creates an Ext4 filesystem using the file as storage, 3. creates the directory /mnt/ext4ramdisk outside the ramfs, 4. loop mounts the image file on /mnt/ext4ramdisk.
      – Johan Myréen
      Oct 30 '17 at 2:44














    up vote
    2
    down vote













    mkdir /mnt/ramdisk
    mount -t ramfs ramfs /mnt/ramdisk
    dd if=/dev/zero of=/mnt/ramdisk/ext4.image bs=1M count=512
    mkfs.ext4 /mnt/ramdisk/ext4.image
    mkdir /mnt/ext4ramdisk
    mount -o loop /mnt/ramdisk/ext4.image /mnt/ext4ramdisk


    But remember, ext4 was not designed to use in ram! tmpfs and ramfs are always better choice in ram than any disk-based filesystem.






    share|improve this answer




















    • I am aware that tmpfs and ramfs are better choices to be used in ram. Could you please clarify exactly what is happening the the last three lines of your answer? Also, if I were to use your solution, how can I verify that /mnt/ext4ramdisk is indeed using ext4?
      – buratino
      Oct 29 '17 at 21:46






    • 1




      The last lines create 1. a big file filled with zeroes on the ramfs, 2. creates an Ext4 filesystem using the file as storage, 3. creates the directory /mnt/ext4ramdisk outside the ramfs, 4. loop mounts the image file on /mnt/ext4ramdisk.
      – Johan Myréen
      Oct 30 '17 at 2:44












    up vote
    2
    down vote










    up vote
    2
    down vote









    mkdir /mnt/ramdisk
    mount -t ramfs ramfs /mnt/ramdisk
    dd if=/dev/zero of=/mnt/ramdisk/ext4.image bs=1M count=512
    mkfs.ext4 /mnt/ramdisk/ext4.image
    mkdir /mnt/ext4ramdisk
    mount -o loop /mnt/ramdisk/ext4.image /mnt/ext4ramdisk


    But remember, ext4 was not designed to use in ram! tmpfs and ramfs are always better choice in ram than any disk-based filesystem.






    share|improve this answer












    mkdir /mnt/ramdisk
    mount -t ramfs ramfs /mnt/ramdisk
    dd if=/dev/zero of=/mnt/ramdisk/ext4.image bs=1M count=512
    mkfs.ext4 /mnt/ramdisk/ext4.image
    mkdir /mnt/ext4ramdisk
    mount -o loop /mnt/ramdisk/ext4.image /mnt/ext4ramdisk


    But remember, ext4 was not designed to use in ram! tmpfs and ramfs are always better choice in ram than any disk-based filesystem.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Oct 29 '17 at 21:35









    Ipor Sircer

    8,9121920




    8,9121920











    • I am aware that tmpfs and ramfs are better choices to be used in ram. Could you please clarify exactly what is happening the the last three lines of your answer? Also, if I were to use your solution, how can I verify that /mnt/ext4ramdisk is indeed using ext4?
      – buratino
      Oct 29 '17 at 21:46






    • 1




      The last lines create 1. a big file filled with zeroes on the ramfs, 2. creates an Ext4 filesystem using the file as storage, 3. creates the directory /mnt/ext4ramdisk outside the ramfs, 4. loop mounts the image file on /mnt/ext4ramdisk.
      – Johan Myréen
      Oct 30 '17 at 2:44
















    • I am aware that tmpfs and ramfs are better choices to be used in ram. Could you please clarify exactly what is happening the the last three lines of your answer? Also, if I were to use your solution, how can I verify that /mnt/ext4ramdisk is indeed using ext4?
      – buratino
      Oct 29 '17 at 21:46






    • 1




      The last lines create 1. a big file filled with zeroes on the ramfs, 2. creates an Ext4 filesystem using the file as storage, 3. creates the directory /mnt/ext4ramdisk outside the ramfs, 4. loop mounts the image file on /mnt/ext4ramdisk.
      – Johan Myréen
      Oct 30 '17 at 2:44















    I am aware that tmpfs and ramfs are better choices to be used in ram. Could you please clarify exactly what is happening the the last three lines of your answer? Also, if I were to use your solution, how can I verify that /mnt/ext4ramdisk is indeed using ext4?
    – buratino
    Oct 29 '17 at 21:46




    I am aware that tmpfs and ramfs are better choices to be used in ram. Could you please clarify exactly what is happening the the last three lines of your answer? Also, if I were to use your solution, how can I verify that /mnt/ext4ramdisk is indeed using ext4?
    – buratino
    Oct 29 '17 at 21:46




    1




    1




    The last lines create 1. a big file filled with zeroes on the ramfs, 2. creates an Ext4 filesystem using the file as storage, 3. creates the directory /mnt/ext4ramdisk outside the ramfs, 4. loop mounts the image file on /mnt/ext4ramdisk.
    – Johan Myréen
    Oct 30 '17 at 2:44




    The last lines create 1. a big file filled with zeroes on the ramfs, 2. creates an Ext4 filesystem using the file as storage, 3. creates the directory /mnt/ext4ramdisk outside the ramfs, 4. loop mounts the image file on /mnt/ext4ramdisk.
    – Johan Myréen
    Oct 30 '17 at 2:44












    up vote
    2
    down vote



    accepted










    I have combined an idea given to me by Ipor Sircer's answer with Stephen Kitt's suggestion of using a RAM disk block device.



    First, I compiled CONFIG_BLK_DEV_RAM into my kernel. I changed the default number of RAM disks from 16 to 8 (BLK_DEV_RAM_COUNT), though that is based on preference and not necessity.



    Next, I created the folder I want to mount to.



    mkdir /mnt/ext4ramdisk



    Finally, I formatted my RAM disk block device with ext4 and mounted it.



    mkfs.ext4 /dev/ram0
    mount -t ext4 /dev/ram0 /mnt/ext4ramdisk





    share|improve this answer
























      up vote
      2
      down vote



      accepted










      I have combined an idea given to me by Ipor Sircer's answer with Stephen Kitt's suggestion of using a RAM disk block device.



      First, I compiled CONFIG_BLK_DEV_RAM into my kernel. I changed the default number of RAM disks from 16 to 8 (BLK_DEV_RAM_COUNT), though that is based on preference and not necessity.



      Next, I created the folder I want to mount to.



      mkdir /mnt/ext4ramdisk



      Finally, I formatted my RAM disk block device with ext4 and mounted it.



      mkfs.ext4 /dev/ram0
      mount -t ext4 /dev/ram0 /mnt/ext4ramdisk





      share|improve this answer






















        up vote
        2
        down vote



        accepted







        up vote
        2
        down vote



        accepted






        I have combined an idea given to me by Ipor Sircer's answer with Stephen Kitt's suggestion of using a RAM disk block device.



        First, I compiled CONFIG_BLK_DEV_RAM into my kernel. I changed the default number of RAM disks from 16 to 8 (BLK_DEV_RAM_COUNT), though that is based on preference and not necessity.



        Next, I created the folder I want to mount to.



        mkdir /mnt/ext4ramdisk



        Finally, I formatted my RAM disk block device with ext4 and mounted it.



        mkfs.ext4 /dev/ram0
        mount -t ext4 /dev/ram0 /mnt/ext4ramdisk





        share|improve this answer












        I have combined an idea given to me by Ipor Sircer's answer with Stephen Kitt's suggestion of using a RAM disk block device.



        First, I compiled CONFIG_BLK_DEV_RAM into my kernel. I changed the default number of RAM disks from 16 to 8 (BLK_DEV_RAM_COUNT), though that is based on preference and not necessity.



        Next, I created the folder I want to mount to.



        mkdir /mnt/ext4ramdisk



        Finally, I formatted my RAM disk block device with ext4 and mounted it.



        mkfs.ext4 /dev/ram0
        mount -t ext4 /dev/ram0 /mnt/ext4ramdisk






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 30 '17 at 3:48









        buratino

        1317




        1317



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f401295%2fhow-can-i-create-an-ext4-ramdisk%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Displaying single band from multi-band raster using QGIS

            How many registers does an x86_64 CPU actually have?