How can I create an ext4 ramdisk?
Clash 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?
mount ext4 tmpfs ramdisk
 |Â
show 4 more comments
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?
mount ext4 tmpfs ramdisk
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 commandmount -tâ¯tmpfs -oâ¯size=512m tmpfs /mnt/ramdisk
consists of five pieces:mount
,âÂÂ-tâ¯tmpfs
,âÂÂ-oâ¯size=512m
,âÂÂtmpfs
âÂÂandâÂÂ/mnt/ramdisk
â the secondtmpfs
doesnâÂÂt go with the-o
.â And the basicmount
syntax ismount
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 ratherdevice
(i.e.,â¯the analog of/dev/sda1
).â And, according to How to correctly mount a tmpfs?, when you have-tâ¯tmpfs
, thedevice
is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported bydf
).â (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 forramfs
).
â G-Man
Oct 29 '17 at 23:35
1
TheFSTYPE
field must be present to get enough command parameters so that themount
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
 |Â
show 4 more comments
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?
mount ext4 tmpfs ramdisk
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?
mount ext4 tmpfs ramdisk
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 commandmount -tâ¯tmpfs -oâ¯size=512m tmpfs /mnt/ramdisk
consists of five pieces:mount
,âÂÂ-tâ¯tmpfs
,âÂÂ-oâ¯size=512m
,âÂÂtmpfs
âÂÂandâÂÂ/mnt/ramdisk
â the secondtmpfs
doesnâÂÂt go with the-o
.â And the basicmount
syntax ismount
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 ratherdevice
(i.e.,â¯the analog of/dev/sda1
).â And, according to How to correctly mount a tmpfs?, when you have-tâ¯tmpfs
, thedevice
is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported bydf
).â (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 forramfs
).
â G-Man
Oct 29 '17 at 23:35
1
TheFSTYPE
field must be present to get enough command parameters so that themount
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
 |Â
show 4 more comments
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 commandmount -tâ¯tmpfs -oâ¯size=512m tmpfs /mnt/ramdisk
consists of five pieces:mount
,âÂÂ-tâ¯tmpfs
,âÂÂ-oâ¯size=512m
,âÂÂtmpfs
âÂÂandâÂÂ/mnt/ramdisk
â the secondtmpfs
doesnâÂÂt go with the-o
.â And the basicmount
syntax ismount
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 ratherdevice
(i.e.,â¯the analog of/dev/sda1
).â And, according to How to correctly mount a tmpfs?, when you have-tâ¯tmpfs
, thedevice
is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported bydf
).â (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 forramfs
).
â G-Man
Oct 29 '17 at 23:35
1
TheFSTYPE
field must be present to get enough command parameters so that themount
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
 |Â
show 4 more comments
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.
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
add a comment |Â
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
add a comment |Â
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.
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
add a comment |Â
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.
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
add a comment |Â
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.
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.
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
add a comment |Â
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
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
answered Oct 30 '17 at 3:48
buratino
1317
1317
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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 secondtmpfs
doesnâÂÂt go with the-o
.â And the basicmount
syntax ismount
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 ratherdevice
(i.e.,â¯the analog of/dev/sda1
).â And, according to How to correctly mount a tmpfs?, when you have-tâ¯tmpfs
, thedevice
is just a placeholder, and not interpreted (but, apparently, it is stored, and subsequently reported bydf
).â (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 forramfs
).â G-Man
Oct 29 '17 at 23:35
1
The
FSTYPE
field must be present to get enough command parameters so that themount
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