+91 9619904949

In IT, developers or System admin needs large files for multiple reasons.
==> create swap files
==> Check hard disk write speed
==> Internet and  LAN speed check
==> Chek development functionality (upload/download speed and limit,)

Commands are used to create a  file.
(1) xfs_mkfile
(2) dd
(3) head
(4) fallocate

head -c 10G </dev/urandom  > myfile

Swap space in Linux is used when the amount of physical memory (RAM) is full. If the system needs more memory resources and the RAM is full, inactive pages in memory are moved to the swap space. Swap space can be a dedicated swap partition (recommended), a swap file, or a combination of swap partitions and swap files. Note:- Btrfs does not support swap space. 

To create a swap file, use the dd command to create an empty file. To create a 1GB file, type:

dd if=/dev/zero of=/swapfile bs=1024 count=1024000

dd is a command for converting and copying a file.
if=/dev/zero or if=/dev/null read from FILE instead of stdin.
of=/swapfile is the name of the swap file.
bs=1024 read 1024 bytes from /dev/zero and write into the /swapfile.
count=1024000 count of 1024000 is the size in kilobytes (i.e. 1GB).

Prepare the swap file using mkswap just as you would a partition, but this time uses the name of the swap file:

mkswap /swapfile

swapon, swapoff – enable/disable devices and files for paging and swapping.

swapon /swapfile.

The /etc/fstab entry for a swap file would look like this:

/swapfile       none    swap    sw      0       0

In the last fire, mount -a to mount all the unmounted filesystems and check free -g to check whether your swap file is mounted or not.