📜 ⬆️ ⬇️

ntfsclone - will create an image as others can not afford

Recently, I met a computer with Windows 7, which periodically refused to contact the Internet. I'll leave the details behind the scenes, I can only say that the problem was clearly not in the gland. Faults need to be corrected, and it so happened that I was the first candidate for the implementation of this postulate.

Reinstalling the system can fix any cant


I’m not very admin from me, I’m setting up a router with difficulty, not to mention repairing such non-trivial things as spontaneous disconnects, but people experienced and experienced in such cases recommend checking for viruses and, if it doesn’t help, reinstall the system.

Anticipating outrage in the comments, I want to make a lyrical digression. Reinstallation will take, say, a day, and the search for root causes in my qualification will last at least a week, so a thoughtful and methodical approach is not an option here.

And if everything goes wrong


So, we will check and, in which case, reinstall. But the computer, of course, is used for work, on it, of course, a bunch of necessary and important files, the employee who uses it, at hand, of course, not. And even if he was - my bitter experience shows that the average user, when asked what files to keep, usually answers “Everything!” And calmly returns to his daily life. And some of these files must lie in a place whose existence no one even suspected.
')

It is better to make a full copy of the section.


The solution to this problem lies on the surface - you really need to save all the files that are on the machine. This can be done by direct copying, but it is usually faster and more convenient to capture the image of the entire disk, since they are microscopic in office computers in modern computers. “Yes, this is a job for ddrescue !” I thought.

However, a more careful study of the disc made me doubt my own adequacy. Winchester, according to the recommendations of the best dog breeders, was divided into a single logical drive, better known to the general public as C. Of the 160 gigabytes it employed, 22. You will agree that copying 138 gigabytes for the sake of twenty-two would be somewhat extravagant.

A copy of the disk, 80 percent of which is not used, it is better to do ntfsclone


You can, of course, fill in the free space with zeros and instruct ddrescue to save the image into a sparse file, but you must first write these zeros and then (during the removal of the image) read. In the case of a hard need to copy the disk image on a small flash drive, this option is, in general, quite a working one, but it looks dumb against the background of the same Acronis.

Since there was practically no doubt about the performance of the disk, I decided that this was the right moment to try one of the utilities designed to create partition images, but, unlike dd and its numerous successors, which take into account the features of the file system. That is, not making a bit-wise copy of the device, but scanning the file allocation table to copy only those areas in which data really exists. Directly on the boot flash drive found ntfsclone, which is part of the package ntfsprogs, created, as you might guess, to work with the file system ntfs.

ntfsclone can create an image file in its own unmounted format


The only thing I was counting on after a brief chat session with Google is to get an image size of 22 gigabytes in a ntfsclone-specific format. I could save this image on a flash drive in order to deploy it in a calm environment to all 160 gigabytes and set antivirus on them.

It is rumored that images made with ntfsclone can be mounted using the imagemount utility, but it was not on the flash drive, so checking the rumors had to be put off until later.

ntfsclone can make a compressed image, mounted by standard means


The results were significantly better than my wildest expectations. Firstly, it turned out that the use of a special format is not a necessity, but a special feature that does not have to be included. Secondly, an ordinary ntfsclone image creates as a sparse file, which means that it will occupy exactly as much space on the disk as is actually used in the cloning partition.

Of the two points announced above, it follows that the image made by ntfsclone can be installed quite easily with the standard mount utility, and there is no need to uncompress something, which means that a virus check can be done on a 22 gigabyte copy of the archive, or on him!

ntfsclone copes with the task of copying from working media


Despite the fact that, as the name implies, the program works only with partitions formatted in ntfs, its usefulness is difficult to overestimate! There is nothing better than mindlessly making a backup copy of an empty 80 percent disk! Saving time is huge, space saving is immense, and there are simply no side effects!

This, of course, if we are talking about creating a backup copy of a working device. But even if the device is defective, it is likely that the defects are located just in areas not occupied by files, that is, where ntfsclone will not climb when copying.

ntfsclone is clear and easy to use


By the way, there is no example in the article. This is because using the program is really very, very easy! But without examples, of course, impossible.

The disk image is obtained by one command.


ntfsclone -o <file where we will save the image> <section which image we are doing>
That is, to remove the C: disk image in the file win_c.img you need to write:
ntfsclone -o win_c.img / dev / sda1
And it's all! Sparse file will be created automatically if such feature is in the file system, in which we put the file with the image.

Mounted image in a completely normal way.


mount -o loop win_c.img win_c

The main thing - when creating an image is not wrong with the format


Be careful! On the Internet, there is often a recommendation to use the argument -s , it is - save-image . Its use will lead to the creation of an image in a ntfsclone-specific format, and, as a result, the inability to mount this image with a standard mount.

ntfsclone is an indispensable tool when creating images of partitions formatted in ntfs


Compared to ddrescue, ntfsclone has two important advantages:

  1. ntfsclone will copy only the actually used disk pieces, no useless baggage.
  2. The image created by ntfsclone, without the --save-image key, can be mounted using standard tools of the operating system.

In general, ntfsclone makes life much easier, use it when the situation allows it.

Source: https://habr.com/ru/post/258199/


All Articles