Fdisk and HDDs

From The World according to Vissie
Jump to navigation Jump to search

Some tips on flash disks and so SSD drives.

http://superuser.com/questions/228657/which-linux-filesystem-works-best-with-ssd

Then for all SSD devices in your system remove relatime if present and add noatime,nodiratime,discard so it looks something like this: /dev/sda / ext4 noatime,nodiratime,discard,errors=remount-ro 0 1

In Linux, simply run fdisk -cu (device) on the drive you want to partition, press n for new partition, p for primary and enter a start sector of at least 2,048. The general rule is that the starting sector must be divisible by 512, but to cater for all variations of SSD page size and filesystem block size, 2,048 is a good idea (and equates to 1MB).

Procedure To Add a Swap File Under Linux

Type the following command to create 512MB swap file (1024 * 512MB = 524288 block size):

dd if=/dev/zero of=/mnt/SWAP bs=1024 count=524288

The following command will create a 1G file at /mnt/SWAP as a swap file.

dd if=/dev/zero of=/mnt/SWAP bs=1024 count=1048576
mkswap /mnt/SWAP

Setup correct file permission for security reasons, enter:

chown root:root /mnt/SWAP
chmod 0600 /mnt/SWAP
swapon /mnt/SWAP
vim: /etc/fstab
/mnt/SWAP         swap       swap    sw         0 0