LVM

LVM is greatly extensible and can be set up into Volume Groups.

You make an LVM drive array on the drives. Then you partition it in two partitions, 2TB each, for both drives that makes VG volume groups. so you have 4 volume ground A0 A1 B0 B1. You put a RAID 1 on A0 and B0 and a RAID 0 on A1 and B1. It's not really partition it's just volume groups. You format your two RAIDs, A is 2TB and B is 4TB. Nice If you are booting from them you have to lose space from the boot partition but it can come from the 4TB VGs. I use a small ssd for boot so no problem cool You can do it in the debian installer if you are installing fresh. I'll note this down Yeah LVM is recommended it's extensible. You can grow a RAID https://raid.wiki.kernel.org/index.php/Growing

From now on, now that I understand the value and power of LVM partitioning, I will set it up for every drive I see.

LVM (Graphical)
or

Graphical partitioning systems are the best way to create logical volumes.

Create MBR or GPT Partitions
First, you should format your drive with a partition table. While LVM can be installed to the entire disk without a partition table, there are severe downsides, especially if you are using a non-UEFI BIOS, and no speed advantages.

While GPT is a superior partition table format, not all BIOSes support it, especially those made before 2012 (when Windows 8 and UEFI was released for PCs). Thus, I chose to use MBR with one partition.

Use GParted to create an MBR Partition table and one Linux LVM partition. Or use  and create one partition with type   (Linux LVM).

http://askubuntu.com/questions/153761/can-i-install-to-a-raw-logical-volume-or-must-i-partition-the-space-first

Create Physical Volume
In this example, the SSD partition is at. This may not always be the case, so be very careful.
 * 1) pvcreate /dev/sda1

Create Volume Group
Now, you can create a volume group for your drive. It might be a good idea to follow a decent naming convention: one where you use your hostname.

You can extend it to other devices as well using.
 * 1) vgcreate vg_stavatron_00 /dev/sda


 * 1) vgextend vg_stavatron_00 /dev/sdc
 * Volume Group Naming Convention

Create Logical Volume
Now we need to create some logical volumes in the volume group. The following partitions are usually prudent choices:

Note: Reserve about 20% of free space above the minimum to handle increased sizes.
 * (100-200MB) - Contains the kernel and other boot information.
 * (15-20GB) - The root partition, containing most of the system.
 * (10-12GB) - Contains many small files. The choice of file system type should consider this fact if a separate partition is used.
 * Because a lot of small read/writes are made to, which can reduce it's working lifetime, you should consider storing it on a hard drive.
 * (tmpfs) - To significantly enhance system performance, the data in  can be stored in RAM instead. This also reduces wear on the SSD. You can set up tmpfs after installation.
 * swap - A swap partition is necessary when RAM is completely used up, or the system needs to store data for hibernation (on a laptop).
 * Alternatively, you could use a variable-size on-demand swapfile on an  partition. NEVER create a swapfile on a   partition.
 * You should reduce the swappiness to a very low level, such as 1.


 * 1) lvcreate -L &lt;size&gt; &lt;volume_group&gt; -n &lt;logical_volume&gt;
 * 2) lvcreate -L 100M vg_stavatron_00 -n lv_boot
 * 3) lvcreate -L 20G vg_stavatron_00 -n lv_root
 * 4) lvcreate -L 15G vg_stavatron_00 -n lv_var
 * 5) lvcreate -l +100%FREE vg_stavatron_00 -n lv_home
 * Arch Linux Wiki - Tmpfs

Filesystem Formats
There are various filesystem formats you can choose from, and each of them bring their own benefits and disadvantages. They also have certain settings that optimize performance on SSDs.


 * - Rock solid, well tested, known to be reliable.  also requires you to use an   filesystem, so this is the best choice.
 * - Relatively new, known for being bleeding edge, but offers higher performance. Make sure you use the latest kernels possible if you plan to use it.
 * However, even though stability is much higher these days,  is not stable enough in comparison to   for situations where corruption caused by the filesystem is unacceptable, in the case of the   partition.
 * The problem with btrfs is that when it fails, it fails HARD. It also doesn't deal with random power outages very well (which can be common on a laptop) and corrupts files to the point that it can't be deleted without a &quot;btrfs check&quot;.
 * In addition, with LVM you cannot resize a  partition. On the flip side, you can make subvolumes under brtfs.
 * In addition, with LVM you cannot resize a  partition. On the flip side, you can make subvolumes under brtfs.

Format the logical volumes you made:


 * 1) mkfs.ext4 /dev/mapper/vg_stavatron_00-lv_boot
 * 2) mkfs.ext4 /dev/mapper/vg_stavatron_00-lv_root
 * 3) mkfs.ext4 /dev/mapper/vg_stavatron_00-lv_var
 * 4) mkfs.ext4 /dev/mapper/vg_stavatron_00-lv_home

-


 * Stack Overflow - Why put things other than /home/ to a separate partition?
 * Arch Linux Wiki - File Systems: Types of File Systems
 * Fedora 15: Recommended Partition Scheme

Is Brtfs Right for me?
http://marc.merlins.org/linux/talks/2015/Btrfs-LCA2015/Btrfs.pdf

Make backups. Always. With Brtfs snapshots, there's no excuse.

Copy over Data with Rsync
I mounted the  partition and sent my 9GB   directory over in just 30 seconds at 91MB/second.

Next, I sent over. I made sure to clean up my pacman cache before doing this step.
 * 1) mkdir /mnt/lv_device
 * 2) mount /dev/mapper/vg_stavatron_00-lv_home  /mnt/lv_device
 * 3) rsync -aAXv /home/* /mnt/lv_device/
 * 4) umount /dev/mapper/vg_stavatron_00-lv_home

After that, I sent over. Unlike the previous ones, we will use the a new  to reduce confusion.
 * 1) mount /dev/mapper/vg_stavatron_00-lv_var  /mnt/lv_device
 * 2) rsync -aAXv /var/* /mnt/lv_device/
 * 3) umount /dev/mapper/vg_stavatron_00-lv_var

Finally, I sent over  with some directories excluded. I excluded  and   since they have their own partitions already (which need to be set in  ).
 * 1) mkdir /mnt/lv_boot
 * 2) mount /dev/mapper/vg_stavatron_00-lv_boot  /mnt/lv_boot
 * 3) rsync -aAXv /boot/* /mnt/lv_boot/
 * 4) umount /dev/mapper/vg_stavatron_00-lv_boot


 * 1) mount /dev/mapper/vg_stavatron_00-lv_root  /mnt/lv_device
 * 2) rsync -aAXv --exclude={&quot;/dev/*&quot;,&quot;/home/*&quot;,&quot;/var/*&quot;,&quot;/proc/*&quot;,&quot;/sys/*&quot;,&quot;/tmp/*&quot;,&quot;/run/*&quot;,&quot;/mnt/*&quot;,&quot;/media/*&quot;,&quot;/lost+found&quot;} /* /mnt/lv_device/
 * 3) umount /dev/mapper/vg_stavatron_00-lv_root
 * Arch Linux Wiki - Full System Backup with Rsync

Chroot into the root
Now, we need to enter the filesystem to set it up further.


 * 1) arch-chroot /mnt/lv_device

Edit
Edit your fstab to match the new configurations. In particular, you need to add mount points for the new  and   logical volumes, as well as SSD optimizaiton options.

Edit the :

Then, edit the entry in the fstab to reference the correct root, home, and var logical volumes. Also add some SSD optimization options, such as  and. The following is what I used:
 * 1) nano /etc/fstab

/dev/mapper/vg_stavatron_00-lv_boot /boot ext4 defaults,noatime,discard 0 2 /dev/mapper/vg_stavatron_00-lv_root / ext4 defaults,noatime,discard 0 1 /dev/mapper/vg_stavatron_00-lv_home /home ext4 defaults,noatime,discard 0 2 /dev/mapper/vg_stavatron_00-lv_var /var ext4 defaults,noatime,discard 0 0 Finally, remount all partitions.

Note: LVM logical volumes should be referenced using, not UUIDs.
 * 1) mount -a

Generate kernel and GRUB Config
We need to create a new Linux kernel with the LVM option, and regenerate GRUB.

First, edit your  to add the   HOOK between block and filesystems. Next, edit the following:

Then, edit  and set. This disables the errant option.
 * 1) mkinitcpio -p linux

Next, edit  and add the   hook to. Then regenerate grub.

Finally, install GRUB to the MBR of the drive.
 * 1) grub-mkconfig -o /boot/grub/grub.cfg


 * 1) grub-install /dev/sda