Difference between revisions of "Mkfs.ext4"
Jump to navigation
Jump to search
↑ https://askubuntu.com/a/841306
(23 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | {{lc}} | ||
+ | * Man page <code>mkfs.ext4</code>: https://linux.die.net/man/8/mkfs.ext4 | ||
+ | * Man page <code>[[ext4]]</code>: https://man7.org/linux/man-pages/man5/ext4.5.html | ||
+ | |||
<pre> | <pre> | ||
mkfs.ext4 /dev/vg01/lv01 | mkfs.ext4 /dev/vg01/lv01 | ||
Line 15: | Line 19: | ||
</pre> | </pre> | ||
+ | [[mkfs.ext4]] /dev/sda222 | ||
+ | mke2fs 1.44.1 (24-Mar-2018) | ||
+ | Found a dos partition table in /dev/sda222 | ||
+ | Proceed anyway? (y,N) y | ||
+ | mkfs.ext4: inode_size (128) * inodes_count (0) too big for a filesystem with 0 blocks, specify higher inode_ratio (-i) or lower inode count (-N). | ||
+ | |||
+ | Review your partition table (<code>[[fdisk -l]] /dev/sda222</code>), read https://www.beinfog.com/systems/dont-try-to-create-file-system-on-an-extended-partition/ | ||
+ | |||
+ | |||
+ | mkfs.ext4 -S | ||
+ | -S Write [[superblock]] and group descriptors only. | ||
+ | |||
+ | |||
+ | Create an ext4 filesystem on a file <ref>https://askubuntu.com/a/841306</ref>: | ||
+ | [[fallocate]] -l 1G /path/to/yourfile | ||
+ | mkfs.ext4 -F /path/to/yourfile | ||
+ | -F force mke2fs to create a filesystem, even if the specified device is not a partition on a block special device, or if other parameters do not make sense. In order to force mke2fs to create a filesystem even if the filesystem appears to be in use or is mounted (a truly dangerous thing to do), this option must be specified twice. (from man page) | ||
+ | sudo [[mount]] /path/to/yourfile /mnt/directory_to_mount | ||
+ | [[df -h]] /mnt/directory_to_mount | ||
+ | |||
+ | |||
+ | mkfs.ext4 /dev/[[nvme1n1]] | ||
== Activities == | == Activities == | ||
− | # Create an [[ext4]] filesystem using <code>[[ | + | # Create an [[ext4]] filesystem using <code>[[mkfs.ext4]]</code> command |
# Learn about bytes per [[inode]] ratio: https://wiki.archlinux.org/index.php/ext4#Bytes-per-inode_ratio | # Learn about bytes per [[inode]] ratio: https://wiki.archlinux.org/index.php/ext4#Bytes-per-inode_ratio | ||
# [[resize2fs]] online and ext4 filesystem | # [[resize2fs]] online and ext4 filesystem | ||
# Learn about Lazy initialization feature of ext4: https://www.thomas-krenn.com/en/wiki/Ext4_Filesystem#Lazy_Initialization and how to avoid it <code>mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/mapper/fc-device</code> | # Learn about Lazy initialization feature of ext4: https://www.thomas-krenn.com/en/wiki/Ext4_Filesystem#Lazy_Initialization and how to avoid it <code>mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/mapper/fc-device</code> | ||
+ | |||
+ | |||
+ | == Related commands == | ||
+ | * <code>[[mount]]</code> | ||
== See also == | == See also == | ||
− | * | + | * {{filesystems}} |
+ | * {{ext4}} | ||
* [[mount]] (/etc/[[fstab]]) | * [[mount]] (/etc/[[fstab]]) | ||
− | * | + | * {{mkfs}} |
* {{lvm commands}} | * {{lvm commands}} | ||
* [[inode]], [[superblock]] and [[block]] size | * [[inode]], [[superblock]] and [[block]] size |
Latest revision as of 11:51, 25 October 2024
- Man page
mkfs.ext4
: https://linux.die.net/man/8/mkfs.ext4 - Man page
ext4
: https://man7.org/linux/man-pages/man5/ext4.5.html
mkfs.ext4 /dev/vg01/lv01 mke2fs 1.44.1 (24-Mar-2018) Creating filesystem with 2441850880 4k blocks and 305233920 inodes Filesystem UUID: e6742357-a181-4b82-837f-9a01f3e52568 Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968, 102400000, 214990848, 512000000, 550731776, 644972544, 1934917632 Allocating group tables: done Writing inode tables: done Creating journal (262144 blocks): done Writing superblocks and filesystem accounting information: done
mkfs.ext4 /dev/sda222
mke2fs 1.44.1 (24-Mar-2018)
Found a dos partition table in /dev/sda222
Proceed anyway? (y,N) y
mkfs.ext4: inode_size (128) * inodes_count (0) too big for a filesystem with 0 blocks, specify higher inode_ratio (-i) or lower inode count (-N).
Review your partition table (fdisk -l /dev/sda222
), read https://www.beinfog.com/systems/dont-try-to-create-file-system-on-an-extended-partition/
mkfs.ext4 -S -S Write superblock and group descriptors only.
Create an ext4 filesystem on a file [1]:
fallocate -l 1G /path/to/yourfile mkfs.ext4 -F /path/to/yourfile -F force mke2fs to create a filesystem, even if the specified device is not a partition on a block special device, or if other parameters do not make sense. In order to force mke2fs to create a filesystem even if the filesystem appears to be in use or is mounted (a truly dangerous thing to do), this option must be specified twice. (from man page) sudo mount /path/to/yourfile /mnt/directory_to_mount df -h /mnt/directory_to_mount
mkfs.ext4 /dev/nvme1n1
Activities[edit]
- Create an ext4 filesystem using
mkfs.ext4
command - Learn about bytes per inode ratio: https://wiki.archlinux.org/index.php/ext4#Bytes-per-inode_ratio
- resize2fs online and ext4 filesystem
- Learn about Lazy initialization feature of ext4: https://www.thomas-krenn.com/en/wiki/Ext4_Filesystem#Lazy_Initialization and how to avoid it
mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/mapper/fc-device
Related commands[edit]
See also[edit]
- File systems: clustered file system,
tune2fs
mkfs.ext4
,superblock, e2fsck,resize2fs
,mount
,df
,umount
, UUID,fstab
ext4
e2fsck,
,fsck.ext4
, superblock, inode, block size, mkfs.ext4 tune2fswipefs
,resize2fs
stat
,extents
, Review ext4 journalctl logs. Read-only file system,virt-resize
, ACL- mount (/etc/fstab)
mkfs
,mkfs.ext4
,mkfs -t, mount
- LVM: LVM errors LVM scan commands
lkvmetad
, Add a new disk
- scan:
pvscan
vgscan
- LVM:
lvs
lvmscan
lvm fullreport
lvmreport
lvmconfig
lvmdump
lvmcheck
lvm dumpconfig
- Scan:
pvs
vgs
lvs
pvscan
vgscan
- PV:
pvcreate
pvremove
pvscan
pvremove
pvscan
pvs
pvchange
pvck
pvdisplay
pvresize
- LV:
lvdisplay
lvcreate
lvremove
,lvresize
,lvextend
,lvreduce
,lvrename
- VG:
vgdisplay
,vgcreate
,vgremove
,vgextend
,vgreduce
,vgscan
,vgchange
,vgrename
,vgcfgbackup
,vgcfgrestore
,vgimportclone
,vgck
- Check commands:
pvck
vgck
- inode, superblock and block size
Advertising: