{
    "content": [
        {
            "type": "text",
            "text": "# e2image (man)\n\n## NAME\n\ne2image - Save critical ext2/ext3/ext4 file system metadata to a file\n\n## SYNOPSIS\n\ne2image  [-r|-Q  [-af]]  [  -b superblock ] [ -B blocksize ] [ -cnps ] [ -o srcoffset ] [ -O\ndestoffset ] device image-file\ne2image -I device image-file\n\n## DESCRIPTION\n\nThe e2image program will save critical ext2, ext3, or ext4 file system  metadata  located  on\ndevice to a file specified by image-file.  The image file may be examined by dumpe2fs and de‐‐\nbugfs, by using the -i option to those programs.  This can assist  an  expert  in  recovering\ncatastrophically corrupted file systems.\n\n## TLDR\n\n> Save critical ext2/ext3/ext4 filesystem metadata to a file.\n\n- Write metadata located on device to a specific file:\n  `e2image {{/dev/sdXN}} {{path/to/image_file}}`\n- Print metadata located on device to `stdout`:\n  `e2image {{/dev/sdXN}} -`\n- Restore the filesystem metadata back to the device:\n  `e2image -I {{/dev/sdXN}} {{path/to/image_file}}`\n- Create a large [r]aw sparse file with metadata at proper offsets:\n  `e2image -r {{/dev/sdXN}} {{path/to/image_file}}`\n- Create a [Q]COW2 image file instead of a normal or raw image file:\n  `e2image -Q {{/dev/sdXN}} {{path/to/image_file}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (13 subsections)\n- **RAW IMAGE FILES**\n- **QCOW2 IMAGE FILES**\n- **OFFSETS**\n- **AUTHOR**\n- **AVAILABILITY**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "e2image",
        "section": "",
        "mode": "man",
        "summary": "e2image - Save critical ext2/ext3/ext4 file system metadata to a file",
        "synopsis": "e2image  [-r|-Q  [-af]]  [  -b superblock ] [ -B blocksize ] [ -cnps ] [ -o srcoffset ] [ -O\ndestoffset ] device image-file\ne2image -I device image-file",
        "tldr_summary": "Save critical ext2/ext3/ext4 filesystem metadata to a file.",
        "tldr_examples": [
            {
                "description": "Write metadata located on device to a specific file",
                "command": "e2image {{/dev/sdXN}} {{path/to/image_file}}"
            },
            {
                "description": "Print metadata located on device to `stdout`",
                "command": "e2image {{/dev/sdXN}} -"
            },
            {
                "description": "Restore the filesystem metadata back to the device",
                "command": "e2image -I {{/dev/sdXN}} {{path/to/image_file}}"
            },
            {
                "description": "Create a large [r]aw sparse file with metadata at proper offsets",
                "command": "e2image -r {{/dev/sdXN}} {{path/to/image_file}}"
            },
            {
                "description": "Create a [Q]COW2 image file instead of a normal or raw image file",
                "command": "e2image -Q {{/dev/sdXN}} {{path/to/image_file}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-a",
                "long": null,
                "arg": null,
                "description": "regular file data. This option will produce an image that is suitable to use to clone the entire FS or for backup purposes. Note that this option only works with the raw (-r) or QCOW2 (-Q) formats. In conjunction with the -r option it is possible to clone all and only the used blocks of one file system to another device/image file."
            },
            {
                "flag": "-b",
                "long": null,
                "arg": null,
                "description": "Get image from partition with broken primary superblock by using the superblock lo‐ cated at file system block number superblock. The partition is copied as-is including broken primary superblock."
            },
            {
                "flag": "-B",
                "long": null,
                "arg": null,
                "description": "Set the file system blocksize in bytes. Normally, e2image will search for the su‐ perblock at various different block sizes in an attempt to find the appropriate block‐ size. This search can be fooled in some cases. This option forces e2fsck to only try locating the superblock with a particular blocksize. If the superblock is not found, e2image will terminate with a fatal error."
            },
            {
                "flag": "-c",
                "long": null,
                "arg": null,
                "description": "the target image-file. If both are already the same, the write will be skipped. This is useful if the file system is being cloned to a flash-based storage device (where reads are very fast and where it is desirable to avoid unnecessary writes to reduce write wear on the device)."
            },
            {
                "flag": "-f",
                "long": null,
                "arg": null,
                "description": "file using the -r and -Q options. Normally, if the source file system is in use, the resulting image file is very likely not going to be useful. In some cases where the source file system is in constant use this may be better than no image at all."
            },
            {
                "flag": "-I",
                "long": null,
                "arg": null,
                "description": "restore the file system metadata back to the device in emergency situations. WARNING!!!! The -I option should only be used as a desperation measure when other alterna‐ tives have failed. If the file system has changed since the image file was created, data will be lost. In general, you should make another full image backup of the file system first, in case you wish to try other recovery strategies afterward."
            },
            {
                "flag": "-n",
                "long": null,
                "arg": null,
                "description": "would have been written."
            },
            {
                "flag": "-o",
                "long": null,
                "arg": null,
                "description": "Specify offset of the image to be read from the start of the source device in bytes. See OFFSETS for more details."
            },
            {
                "flag": "-O",
                "long": null,
                "arg": null,
                "description": "Specify offset of the image to be written from the start of the target image-file in bytes. See OFFSETS for more details."
            },
            {
                "flag": "-p",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "-Q",
                "long": null,
                "arg": null,
                "description": "virtual machine images, and other tools that can use the .qcow image format. See QCOW2 IMAGE FILES below for details."
            },
            {
                "flag": "-r",
                "long": null,
                "arg": null,
                "description": "details."
            },
            {
                "flag": "-s",
                "long": null,
                "arg": null,
                "description": "written image file to avoid revealing information about the contents of the file sys‐ tem. However, this will prevent analysis of problems related to hash-tree indexed di‐ rectories."
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "dumpe2fs",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/dumpe2fs/8/json"
            },
            {
                "name": "debugfs",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/debugfs/8/json"
            },
            {
                "name": "e2fsck",
                "section": "8",
                "url": "https://www.chedong.com/phpMan.php/man/e2fsck/8/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 30,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-a",
                        "lines": 5,
                        "flag": "-a"
                    },
                    {
                        "name": "-b",
                        "lines": 4,
                        "flag": "-b"
                    },
                    {
                        "name": "-B",
                        "lines": 6,
                        "flag": "-B"
                    },
                    {
                        "name": "-c",
                        "lines": 5,
                        "flag": "-c"
                    },
                    {
                        "name": "-f",
                        "lines": 4,
                        "flag": "-f"
                    },
                    {
                        "name": "-I",
                        "lines": 7,
                        "flag": "-I"
                    },
                    {
                        "name": "-n",
                        "lines": 2,
                        "flag": "-n"
                    },
                    {
                        "name": "-o",
                        "lines": 3,
                        "flag": "-o"
                    },
                    {
                        "name": "-O",
                        "lines": 3,
                        "flag": "-O"
                    },
                    {
                        "name": "-p",
                        "lines": 1,
                        "flag": "-p"
                    },
                    {
                        "name": "-Q",
                        "lines": 3,
                        "flag": "-Q"
                    },
                    {
                        "name": "-r",
                        "lines": 2,
                        "flag": "-r"
                    },
                    {
                        "name": "-s",
                        "lines": 5,
                        "flag": "-s"
                    }
                ]
            },
            {
                "name": "RAW IMAGE FILES",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "QCOW2 IMAGE FILES",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "OFFSETS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "e2image - Save critical ext2/ext3/ext4 file system metadata to a file\n\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "e2image  [-r|-Q  [-af]]  [  -b superblock ] [ -B blocksize ] [ -cnps ] [ -o srcoffset ] [ -O\ndestoffset ] device image-file\ne2image -I device image-file\n\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The e2image program will save critical ext2, ext3, or ext4 file system  metadata  located  on\ndevice to a file specified by image-file.  The image file may be examined by dumpe2fs and de‐‐\nbugfs, by using the -i option to those programs.  This can assist  an  expert  in  recovering\ncatastrophically corrupted file systems.\n\nIt  is  a  very good idea to create image files for all file systems on a system and save the\npartition layout (which can be generated using the fdisk -l command) at regular intervals ---\nat  boot  time, and/or every week or so.  The image file should be stored on some file system\nother than the file system whose data it contains, to ensure that this data is accessible  in\nthe case where the file system has been badly damaged.\n\nTo  save  disk  space,  e2image  creates the image file as a sparse file, or in QCOW2 format.\nHence, if the sparse image file needs to be copied to another location, it should  either  be\ncompressed  first  or  copied  using  the --sparse=always option to the GNU version of cp(1).\nThis does not apply to the QCOW2 image, which is not sparse.\n\nThe size of an ext2 image file depends primarily on the size of the file systems and how many\ninodes  are in use.  For a typical 10 Gigabyte file system, with 200,000 inodes in use out of\n1.2 million inodes, the image file will be approximately 35 Megabytes; a 4 Gigabyte file sys‐\ntem  with  15,000 inodes in use out of 550,000 inodes will result in a 3 Megabyte image file.\nImage files tend to be quite compressible; an image file taking up 32 Megabytes of  space  on\ndisk will generally compress down to 3 or 4 Megabytes.\n\nIf  image-file  is -, then the output of e2image will be sent to standard output, so that the\noutput can be piped to another program, such as gzip(1).  (Note that this is  currently  only\nsupported when creating a raw image file using the -r option, since the process of creating a\nnormal image file, or QCOW2 image currently requires random access to the file, which  cannot\nbe done using a pipe.\n\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-a",
                        "content": "regular file data.  This option will produce an image that is suitable to use to clone\nthe  entire  FS or for backup purposes.  Note that this option only works with the raw\n(-r) or QCOW2 (-Q) formats.  In conjunction with the -r option it is possible to clone\nall and only the used blocks of one file system to another device/image file.\n",
                        "flag": "-a"
                    },
                    {
                        "name": "-b",
                        "content": "Get  image  from  partition with broken primary superblock by using the superblock lo‐\ncated at file system block number superblock.  The partition is copied as-is including\nbroken primary superblock.\n",
                        "flag": "-b"
                    },
                    {
                        "name": "-B",
                        "content": "Set  the  file  system  blocksize in bytes.  Normally, e2image will search for the su‐\nperblock at various different block sizes in an attempt to find the appropriate block‐\nsize.  This search can be fooled in some cases.  This option forces e2fsck to only try\nlocating the superblock with a particular blocksize. If the superblock is  not  found,\ne2image will terminate with a fatal error.\n",
                        "flag": "-B"
                    },
                    {
                        "name": "-c",
                        "content": "the target image-file.  If both are already the same, the write will be skipped.  This\nis  useful  if  the file system is being cloned to a flash-based storage device (where\nreads are very fast and where it is desirable to avoid unnecessary  writes  to  reduce\nwrite wear on the device).\n",
                        "flag": "-c"
                    },
                    {
                        "name": "-f",
                        "content": "file using the -r and -Q options.  Normally, if the source file system is in use,  the\nresulting  image  file  is very likely not going to be useful. In some cases where the\nsource file system is in constant use this may be better than no image at all.\n",
                        "flag": "-f"
                    },
                    {
                        "name": "-I",
                        "content": "restore the file system metadata back to the device in emergency situations.\n\nWARNING!!!!   The  -I option should only be used as a desperation measure when other alterna‐\ntives have failed.  If the file system has changed since the image  file  was  created,  data\nwill  be  lost.   In  general,  you  should make another full image backup of the file system\nfirst, in case you wish to try other recovery strategies afterward.\n",
                        "flag": "-I"
                    },
                    {
                        "name": "-n",
                        "content": "would have been written.\n",
                        "flag": "-n"
                    },
                    {
                        "name": "-o",
                        "content": "Specify  offset  of the image to be read from the start of the source device in bytes.\nSee OFFSETS for more details.\n",
                        "flag": "-o"
                    },
                    {
                        "name": "-O",
                        "content": "Specify offset of the image to be written from the start of the target  image-file  in\nbytes.  See OFFSETS for more details.\n",
                        "flag": "-O"
                    },
                    {
                        "name": "-p",
                        "content": "",
                        "flag": "-p"
                    },
                    {
                        "name": "-Q",
                        "content": "virtual machine images, and other tools that can use the .qcow image format. See QCOW2\nIMAGE FILES below for details.\n",
                        "flag": "-Q"
                    },
                    {
                        "name": "-r",
                        "content": "details.\n",
                        "flag": "-r"
                    },
                    {
                        "name": "-s",
                        "content": "written  image file to avoid revealing information about the contents of the file sys‐\ntem.  However, this will prevent analysis of problems related to hash-tree indexed di‐\nrectories.\n\n",
                        "flag": "-s"
                    }
                ]
            },
            "RAW IMAGE FILES": {
                "content": "The  -r  option  will  create a raw image file, which differs from a normal image file in two\nways.  First, the file system metadata is placed in the same relative  offset  within  image-\nfile  as it is in the device so that debugfs(8), dumpe2fs(8), e2fsck(8), losetup(8), etc. and\ncan be run directly on the raw image file.  In order to minimize the  amount  of  disk  space\nconsumed  by  the raw image file, it is created as a sparse file.  (Beware of copying or com‐\npressing/decompressing this file with utilities that don't understand how  to  create  sparse\nfiles;  the  file  will  become as large as the file system itself!)  Secondly, the raw image\nfile also includes indirect blocks and directory blocks, which the standard image  file  does\nnot have.\n\nRaw image files are sometimes used when sending file systems to the maintainer as part of bug\nreports to e2fsprogs.  When used in this capacity, the recommended command is as follows (re‐\nplace hda1 with the appropriate device for your system):\n\ne2image -r /dev/hda1 - | bzip2 > hda1.e2i.bz2\n\nThis  will  only  send the metadata information, without any data blocks.  However, the file‐\nnames in the directory blocks can still reveal information about the  contents  of  the  file\nsystem  that the bug reporter may wish to keep confidential.  To address this concern, the -s\noption can be specified to scramble the filenames in the image.\n\nNote that this will work even if you substitute /dev/hda1 for  another  raw  disk  image,  or\nQCOW2 image previously created by e2image.\n\n",
                "subsections": []
            },
            "QCOW2 IMAGE FILES": {
                "content": "The -Q option will create a QCOW2 image file instead of a normal, or raw image file.  A QCOW2\nimage contains all the information the raw image does, however unlike the raw image it is not\nsparse.  The QCOW2 image minimize the amount of space used by the image by storing it in spe‐\ncial format which packs data closely together, hence avoiding holes  while  still  minimizing\nsize.\n\nIn order to send file system to the maintainer as a part of bug report to e2fsprogs, use fol‐\nlowing commands (replace hda1 with the appropriate device for your system):\n\ne2image -Q /dev/hda1 hda1.qcow2\nbzip2 -z hda1.qcow2\n\nThis will only send the metadata information, without any data blocks.  As described for  RAW\nIMAGE FILES the -s option can be specified to scramble the file system names in the image.\n\nNote that the QCOW2 image created by e2image is a regular QCOW2 image and can be processed by\ntools aware of QCOW2 format such as for example qemu-img.\n\nYou can convert a .qcow2 image into a raw image with:\n\ne2image -r hda1.qcow2 hda1.raw\n\nThis can be useful to write a QCOW2 image containing all data to a sparse image file where it\ncan  be  loop mounted, or to a disk partition.  Note that this may not work with QCOW2 images\nnot generated by e2image.\n\n",
                "subsections": []
            },
            "OFFSETS": {
                "content": "Normally a file system starts at the beginning of a partition, and e2image is run on the par‐\ntition.   When working with image files, you don't have the option of using the partition de‐\nvice, so you can specify the offset where the file system starts directly with the -o option.\nSimilarly  the -O option specifies the offset that should be seeked to in the destination be‐\nfore writing the file system.\n\nFor example, if you have a dd image of a whole hard drive that contains an ext2 fs in a  par‐\ntition starting at 1 MiB, you can clone that image to a block device with:\n\ne2image -aro 1048576 img /dev/sda1\n\nOr  you  can  clone a file system from a block device into an image file, leaving room in the\nfirst MiB for a partition table with:\n\ne2image -arO 1048576 /dev/sda1 img\n\nIf you specify at least one offset, and only one file, an in-place move  will  be  performed,\nallowing you to safely move the file system from one offset to another.\n\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "e2image was written by Theodore Ts'o (tytso@mit.edu).\n\n",
                "subsections": []
            },
            "AVAILABILITY": {
                "content": "e2image  is  part  of  the  e2fsprogs  package and is available from http://e2fsprogs.source‐\nforge.net.\n\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "dumpe2fs(8), debugfs(8) e2fsck(8)\n\n\n\nE2fsprogs version 1.46.5                    December 2021                                 E2IMAGE(8)",
                "subsections": []
            }
        }
    }
}