Linux Talk | Partition Schemes, Swap Space and File Fragmentation

Linux Talk | Partition Schemes, Swap Space and File Fragmentation

55.805 Lượt nghe
Linux Talk | Partition Schemes, Swap Space and File Fragmentation
PARTITIONING There are many options for partitioning drive space in Linux. Each has its own advantages. Here are just a few examples: Default PART FS MOUNT SIZE sda1 ext4 / Drive space minus swap sda5 swap none RAM size plus 100 MB Advanced PART FS MOUNT SIZE sda1 ext4 / 15 to 32 GB sda2 swap none RAM size plus 100 MB sda3 ext4 /home Remaining drive space My scheme for boasting VM performance sda1 ext4 / 32 GB sda2 swap none 8 GB sda3 ext4 /home 600 GB sda4 xfs /vm 300 GB SWAP PARTITIONS AND FILES Swap space provides memory for the kernel to use at times when physical RAM is running out. Swap can be set aside in its own partition or it can be in a swap file within a file system. Some programs use swap space independently of the kernel. Swap is also used to dump the contents of RAM when there is a hard crash. There must be a separate swap partition that is slightly larger than the total system RAM space in order to use hibernation. To create a swapfile: First cd into / then run these commands as root; dd if=/dev/zero of=swapfile-name bs=1024k count=MB-num mkswap swapfile-name swapon swapfile-name To mount the swap file at boot time add this line to /etc/fstab: /swapfile-name none swap sw 0 0 EXT4 AND XFS FILE FRAGMENTATION Do you need to defrag your drives? Probably not. SSD should NEVER be dfragged. You may want to check fragmentation status with: sudo e4defrag -c path-name or device name Most likely, the fragmentation score will be 0. Those with very large files or drives that are running at more then 75 per cent capacity may want to run a defrag. sudo e4defrag path-name or device name Do not expect a big performance boost, though. Ext4 and XFS both run faster even with fragmented files.