 Hello everybody! In today's video, we will discuss sparse files. Keep on watching to find out what files are called sparse files, what are their browsing codes, what file systems support them, how to create a sparse file, and how to transform an ordinary file into a sparse file. Hello friends! If you need to recover deleted data, view or restore removed browser history. Hetman Software products will help you. Follow the link in the description, download the necessary program for free, install it, and analyze the disk. The utility will show you the data you can recover, so you will be able to view it or get it back. In our channel and blog, you will find solutions to any problem, from installing an operating system or configuring it to fixing possible bugs and errors or optimizing mobile gadgets. Our specialists will answer any questions you ask in your comments, under the videos or articles. Many applications, and especially databases, keep their information in sparse files. This is the kind of file that tries to use the file system in a more efficient way without occupying disk space when the file is almost empty. In fact, with this file type, your stored device is only used when necessary. The information which is not written to the disk is presented in the form of zeros and is stored in the file system metadata. This way, such files will take less space on the disk than their size which is displayed. This file type is supported by most file systems, and you can see their list on the screen right now. Although sparse files are supported by these file systems, it is impossible to access their functionality directly through the interface of the operating system. Files of this type can only be managed with the command prompt. A bit later, we'll explore it in more detail. In addition to sparse file support, operating systems also have a feature known as the file compression. Those tools give you an advantage of saving disk space, but they achieve this goal in different ways. The main downside of using file compression is that it affects system performance when reading or writing such files, because the system needs extra resources to compress or decompress the data. For some programs, it is inadmissible, and that is the case when it's better to use sparse files. The biggest advantage of sparse files is that users can create very large files which take very little disk space. The space for storing data is allocated automatically as more and more information is written. Such sparse files are created relatively quickly because the file system doesn't have to preallocate disk space for writing zeros. However, the advantages of sparse files are limited to the applications that support them. If a certain program cannot recognize or use such files, it will save a sparse file in its original, uncompressed form, and there is no advantage to talk about. Users have to be careful when dealing with such files, as sparse files of a few megabytes may suddenly turn into a several-gigabyte monster when an application which doesn't support this file type copies it into a directory. One more disadvantage is that you can't copy or create a sparse file if its nominal size exceeds the amount of available free space of water restrictions applied to user accounts within the operating system. For example, if the original size of a sparse file with all of its zero bytes is 500 megabytes, and the quota limit for the user account where the sparse file is created is only 400 megabytes, such situation generates an error. Even if the actual disk space occupied by this sparse file is only 50 megabytes, as to the hard disks where sparse files are stored, they are also subject to fragmentation, because the file system will write data to sparse files as and when necessary. Over time, it may result in reduced performance. Besides, some disk management utilities may have issues with displaying free disk space. When the file system containing files of this specific type is low on space, it may lead to unpredictable situations. For example, it may generate disk overfill issues when data is copied over the existing part of the file, which is marked as sparse. To create a sparse file in Windows, we'll be using command prompt. Type cmd in the search field and run it as administrator. In Windows, sparse files are managed with the help of fsutil2, a file system utility. When the command create is performed, by default it creates a file which is not a sparse one. Go to the folder where a sparse file needs to be created and type the following command. Where a sparse file is the file name and the number at the end is the file size in bytes. To assign the sparse attribute to the file, use this command. To remove the sparse flag, use another command. To assign the sparse attribute again, type one more command. The attribute by itself doesn't let you start saving disk space. To make it happen, you need to set the empty space which should be freed inside the file. Set the empty space with this command. At the end of the command, the offset and lengths are given in bytes. In my case, this is the range from 0 to 1 gigabyte. To set a fully sparse file, specify the whole capacity. You can expand the file if necessary by typing a larger value. To make sure the file has been assigned this attribute, run the command. This sparse attribute can be assigned to any file by just running this command with the corresponding file's name and setting the desired file size. In the properties of the file we have created earlier, you can see that with the size of 1 gigabyte, this file occupies 0 bytes on disk. This set of commands works with all Windows file systems that support sparse files NTFS, RFS, and so on. In Linux, the process of creating a sparse file is a bit easier, because there are several commands to create files of this time. This set of commands works with all Linux file systems that support sparse files. You can either use the DD command or the truncate command. The first command looks like this. Where file sparse is the file name, and the number at the end is the size that can be set in bytes, megabytes, and so on. The second command is simpler, where the S value stands for the file size, and it is followed by the file name. Contrary to Windows, when you create a file with either command, it will be a sparse file by default. To turn an ordinary file into a sparse one, there is a special command. Where 025.jpg is the name of the first file, an ordinary one, and 026.jpg is the name of the second file as sparse one. If you need to expand an existing file, use the first command below. Replace the name and specify the size you need. This command will increase its size to 2 gigabytes. Use the following command to check the size. In fact, this set of commands works with the Apple file system, APFS, as Linux and macOS are based on the Unix architecture, and they both provide access to Unix commands and the Bash command shell. Search the terminal and run any command for creating a sparse file that I have just used in Linux. In macOS Catalina, only the first command is supported, and the size should be given in bytes. Otherwise, the command will generate an error. When certain conditions are observed, APFS file system creates sparse files by default, so you can expand any file with the command used to increase the size of sparse files in Linux. Let's set the size to 500 megabytes and remember that in macOS this size should be specified in bytes. When you run the command and open file properties, you can see that its size has increased to 500 megabytes. If you removed some files or format a disk with important information, and those files turned out to be sparse files, keep calm and carry on with Hetman Partition Recovery or Hetman Rated Recovery, our products can work with sparse files in all operating systems, and files it's mentioned in this video. Download, install and run the program to scan your disk. As you can see, this program can find both existing and deleted sparse files easily, and display their contents. When you open the file in mihack's editor, you can make sure that it is filled with zeros. The program managed to find previously removed sparse files on the disk using NTFS, RAFS, BTRFS, EXT3, EXT4 and APFS file systems. All you have to do is to select the data you need and click Recovery. When the recovery process is over, you will find all of the files in the folder you have chosen. Check the file properties to find out that the files have been recovered in full. Summing up, the decision to use sparse files in any of the operating systems that support them has its pros and cons, so think about possible downsides before choosing this option. Knowing about issues you may face while using sparse files can help you to avoid potential problems in the future. And that is all for now. Hopefully, this video was useful, and remember to click the Like button and subscribe to our channel. Push the bell button to receive notifications and never miss new videos. Leave comments, stars, questions. Thank you for watching. Good luck.