Lines Matching defs:image
7 * Special image format support copyright (c) 2004 Per Olofsson
9 * Clone NTFS data and/or metadata to a sparse file, image, device or stdout.
197 ntfs_walk_clusters_ctx *image;
222 #define IMAGE_MAGIC "\0ntfsclone-image"
233 * stupidly used the volume version as the image version... )-: I hope NTFS
237 * NOTE: Only bump the minor version if the image format and header are still
357 " Efficiently clone NTFS to a sparse file, image, device or standard output.\n"
361 " -s, --save-image Save to the special image format\n"
362 " -r, --restore-image Restore from the special image format\n"
379 " If FILE is '-' then send the image to the standard output. If SOURCE is '-'\n"
380 " and --restore-image is used then read the image from the standard input.\n"
393 "Efficiently clone, image, restore or rescue an NTFS Volume.\n\n"
415 { "restore-image", no_argument, NULL, 'r' },
421 { "save-image", no_argument, NULL, 's' },
522 err_exit("Restoring only metadata from an image is not "
533 err_exit("Saving and restoring an image at the same time "
633 static s64 is_critical_metadata(ntfs_walk_clusters_ctx *image, runlist *rl)
635 s64 inode = image->ni->mft_no;
640 if (inode == FILE_BadClus && image->ctx->attr->type == AT_DATA)
646 if (image->ctx->attr->type == AT_DATA) {
660 if (image->ctx->attr->type != AT_DATA)
795 err_exit("Short image file...\n");
817 * in the image header, so we collect it on the fly
949 Printf("Saving NTFS to image ...\n");
1027 Printf("Restoring NTFS from image ...\n");
1043 " sector in image\n");
1053 /* little endian image, on any computer */
1059 /* big endian image on big endian computer */
1070 " image to stdout\n");
1078 err_exit("restore_image: corrupt image "
1271 static void wipe_timestamps(ntfs_walk_clusters_ctx *image)
1274 ATTR_RECORD *a = image->ctx->attr;
1287 static void wipe_resident_data(ntfs_walk_clusters_ctx *image)
1294 a = image->ctx->attr;
1297 if (image->ni->mft_no <= LAST_METADATA_INODE)
1354 static void clone_logfile_parts(ntfs_walk_clusters_ctx *image, runlist *rl)
1360 vcn = offset / image->ni->vol->cluster_size;
1367 if ((lcn + 1) != image->current_lcn) {
1370 gap_to_cluster(lcn - image->current_lcn);
1374 image->current_lcn = lcn + 1;
1376 image->inuse++;
1394 ntfs_walk_clusters_ctx image;
1401 image.ni = ∋
1416 image.ctx = ctx;
1419 wipe_resident_data(&image);
1421 wipe_timestamps(&image);
1503 static void copy_wipe_mft(ntfs_walk_clusters_ctx *image, runlist *rl)
1520 current_lcn = image->current_lcn;
1521 mft_record_size = image->ni->vol->mft_record_size;
1522 csize = image->ni->vol->cluster_size;
1523 bytes_per_sector = image->ni->vol->sector_size;
1524 fd = image->ni->vol->dev;
1574 image->current_lcn = current_lcn;
1586 static void copy_wipe_i30(ntfs_walk_clusters_ctx *image, runlist *rl)
1602 current_lcn = image->current_lcn;
1603 csize = image->ni->vol->cluster_size;
1604 bytes_per_sector = image->ni->vol->sector_size;
1605 fd = image->ni->vol->dev;
1611 indx_record_size = image->ni->vol->indx_record_size;
1656 image->current_lcn = current_lcn;
1660 static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl)
1669 if (!(len = is_critical_metadata(image, rl)))
1675 gap_to_cluster(rl->lcn - image->current_lcn);
1680 image->current_lcn = rl->lcn + len;
1693 ctx = walk->image->ctx;
1698 wipe_resident_data(walk->image);
1700 wipe_timestamps(walk->image);
1707 && walk->image->ctx->attr->type == AT_INDEX_ALLOCATION)
1708 wipe_index_allocation_timestamps(walk->image->ni, a);
1714 mft_data = ((walk->image->ni->mft_no == FILE_MFT)
1715 || (walk->image->ni->mft_no == FILE_MFTMirr))
1717 index_i30 = (walk->image->ctx->attr->type == AT_INDEX_ALLOCATION)
1738 dump_clusters(walk->image, rl + i);
1756 walk->image->inuse += lcn_length;
1758 * For a metadata image, we have to compute the
1763 if ((walk->image->ni->mft_no == FILE_LogFile)
1764 && (walk->image->ctx->attr->type == AT_DATA)) {
1766 walk->image->inuse
1767 += is_critical_metadata(walk->image,rl);
1769 if ((walk->image->ni->mft_no
1771 || (walk->image->ctx->attr->type != AT_DATA))
1772 walk->image->inuse += lcn_length;
1784 na = ntfs_attr_open(walk->image->ni,
1790 copy_wipe_mft(walk->image,na->rl);
1793 (long long)walk->image->ni->mft_no);
1797 (long long)walk->image->ni->mft_no);
1800 na = ntfs_attr_open(walk->image->ni,
1806 copy_wipe_i30(walk->image,na->rl);
1809 (long long)walk->image->ni->mft_no);
1813 (long long)walk->image->ni->mft_no);
1818 && (walk->image->ni->mft_no == FILE_LogFile)
1819 && (walk->image->ctx->attr->type == AT_DATA))
1820 clone_logfile_parts(walk->image, rl);
1830 if (!(ctx = ntfs_attr_get_search_ctx(walk->image->ni, NULL)))
1837 walk->image->ctx = ctx;
1974 walk->image->current_lcn = 0;
2032 walk->image->ni = ni;
2051 gap_to_cluster(-walk->image->current_lcn);
2053 walk->image->current_lcn = 0;
2061 - walk->image->current_lcn);
2063 walk->image->current_lcn = nr_clusters;
2067 walk->image->inuse++;
2133 Printf("Ntfsclone image version: %d.%d\n",
2145 Printf("Offset to image data : %u (0x%x) bytes\n",
2350 "by using the more efficient --save-image "
2351 "option\nof ntfsclone. Use the --restore-image "
2352 "option to restore the image.\n");
2390 perr_exit("failed to open image");
2395 err_exit("Input file is not an image! (invalid magic)\n");
2401 * old image read on a big endian computer,
2405 Printf("Old image format detected. If the image was created "
2408 "ntfsclone to recreate the image.\n");
2419 /* safe image : little endian data */
2424 err_exit("Do not know how to handle image format "
2429 /* Read the image header data offset. */
2503 "NTFS image (%lld).\n",
2511 static void ignore_bad_clusters(ntfs_walk_clusters_ctx *image)
2539 image->inuse--;
2590 ntfs_walk_clusters_ctx image;
2602 /* print to stderr, stdout can be an NTFS image ... */
2679 memset(&image, 0, sizeof(image));
2680 backup_clusters.image = ℑ
2683 image.more_use = compare_bitmaps(&lcn_bitmap,
2685 print_disk_usage("", vol->cluster_size, vol->nr_clusters, image.inuse);
2687 check_dest_free_space(vol->cluster_size * image.inuse);
2689 ignore_bad_clusters(&image);
2692 initialise_image_hdr(device_size, image.inuse);
2695 s64 nr_clusters_to_save = image.inuse;
2700 clone_ntfs(nr_clusters_to_save, image.more_use);
2711 initialise_image_hdr(device_size, image.inuse);
2729 memset(&image, 0, sizeof(image));
2730 backup_clusters.image = ℑ