HDD: Difference between revisions

From Q
Jump to navigation Jump to search
Tgurr (talk | contribs)
No edit summary
Tgurr (talk | contribs)
Line 104: Line 104:


* You could go for relatime as a compromise instead, but there are currently no known issues (exception is mutt) when using noatime
* You could go for relatime as a compromise instead, but there are currently no known issues (exception is mutt) when using noatime
* discard enables the TRIM function (should be available on all modern SSDs, check with {{Root|hdparm -I /dev/yourssd | grep TRIM}})
* discard enables the TRIM function which should be available on all modern SSDs, check with {{Root|hdparm -I /dev/yourssd | grep TRIM}}
* mdraid, dm-crypt and the loopback block driver support support passing discard commands to the underlying layer(s) since kernel 3.7
* mdraid, dm-crypt and the loopback block driver support support passing discard commands to the underlying layer(s) since kernel 3.7



Revision as of 01:24, 12 December 2012

Apart from the last step, setting up /etc/fstab there are no differences between partitioning a HDD or SSD drive. All modern Linux partitioning tools take care of aligning the partitions automatically.

Create a simple Linux GPT partition layout

Code: Simple GPT partition layout
/dev/sda1	1   MiB		EF02	BIOS boot	BIOS boot partition
/dev/sda2	100 MiB	/boot	8300	ext4		Linux filesystem
/dev/sda3	512 MiB		8200	swap		Linux swap
/dev/sda4	25  GiB	/	8300	ext4		Linux filesystem


# gdisk /dev/sda


Code: gdisk commands
Command (? for help): p
Disk /dev/sda: 156301488 sectors, 74.5 GiB
[...]

n
1
enter
+1M
EF02

n
2
enter
+100M
8300

n
3
enter
+512M
8200

n
4
enter
enter
8300

p
w
Y

Create the filesystems

# mkfs.ext4 /dev/sda2
# mkswap /dev/sda3
# mkfs.ext4 /dev/sda4

Label the filesystems

# tune2fs -L boot /dev/sda2
# mkswap -L swap /dev/sda3
# tune2fs -L root /dev/sda4

And verify with:

# blkid

Mount the filesystems

# mkdir -p /mnt/exherbo
# swapon /dev/sda3
# mount /dev/sda4 /mnt/exherbo
# mkdir /mnt/exherbo/boot
# mount /dev/sda2 /mnt/exherbo/boot

Configure /etc/fstab

List the UUID's with:

# blkid


Configure /etc/fstab (HDD)

File: /etc/fstab
UUID=0930a69b-f2d5-4607-93fe-4f8bfdf2ea87       /boot   ext4    defaults        0 2
UUID=8431f5f2-0cb1-4831-aed2-00d618543e0a       swap    swap    defaults        0 0
UUID=cf602240-7bac-4b29-8930-2080a5aac7cd       /       ext4    defaults        0 1

Configure /etc/fstab (SSD)

  • You could go for relatime as a compromise instead, but there are currently no known issues (exception is mutt) when using noatime
  • discard enables the TRIM function which should be available on all modern SSDs, check with
    # hdparm -I /dev/yourssd
  • mdraid, dm-crypt and the loopback block driver support support passing discard commands to the underlying layer(s) since kernel 3.7
File: /etc/fstab
UUID=0930a69b-f2d5-4607-93fe-4f8bfdf2ea87       /boot   ext4    defaults,noatime,discard,noauto        0 2
UUID=8431f5f2-0cb1-4831-aed2-00d618543e0a       swap    swap    defaults                               0 0
UUID=cf602240-7bac-4b29-8930-2080a5aac7cd       /       ext4    defaults,noatime,discard               0 1


Then proceed to configure GRUB and your Kernel.