UbuntuRAID0ssd: Difference between revisions

From DrewWiki
Jump to navigation Jump to search
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
Ubuntu RAID0 SSD no root w/o boot partition
Ubuntu RAID0 SSD no root w/o boot partition


== During install ==
== Start install media ==
=== Jump over to another tty ===
=== Jump over to another tty ===
<pre># apt-get install lvm2</pre>
<syntaxhighlight lang=bash>
# apt-get -y install lvm2
</syntaxhighlight>


=== Make sure partition starts on 2048 ===
=== Make sure partition starts on 2048 ===
<pre># fdisk /dev/sda
<syntaxhighlight lang=bash># fdisk -l
/dev/sda1         2048  175836159   87668224   8e  Linux LVM</pre>
 
Disk /dev/sda: 32.0 GB, 32017047552 bytes
132 heads, 63 sectors/track, 7519 cylinders, total 62533296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a5046
 
  Device Boot      Start        End      Blocks  Id  System
/dev/sda1           2048   62533295    31265624  8e  Linux LVM
 
Disk /dev/sdb: 32.0 GB, 32017047552 bytes
132 heads, 63 sectors/track, 7519 cylinders, total 62533296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd67db81c
 
  Device Boot      Start        End      Blocks   Id  System
/dev/sdb1            2048   62533295    31265624   8e  Linux LVM
</syntaxhighlight>


=== Create PV's with aligned metadata ===
=== Create PV's with aligned metadata ===
<pre># pvcreate --metadatasize 250k /dev/sda1
<syntaxhighlight lang=bash>
# pvcreate --metadatasize 250k /dev/sdb1</pre>
# pvcreate --metadatasize 250k /dev/sda1
# pvcreate --metadatasize 250k /dev/sdb1
</syntaxhighlight>


=== Create VG and LV ===
=== Create VG and LV ===
<pre># vgcreate  vgssd /dev/sda1 /dev/sdb1
<syntaxhighlight lang=bash>
# vgcreate  vgssd /dev/sda1 /dev/sdb1
# vgdisplay vgssd | grep Total
# vgdisplay vgssd | grep Total
   Total PE              15266
   Total PE              15266
# lvcreate -i2 -I128 -n lvssd vgssd --extents 15266</pre>
# lvcreate -i2 -I128 -n lvssd vgssd --extents 15266
</syntaxhighlight>


=== Create file system ===
=== Create file system ===
<pre># mkfs.ext4 -v -O ^has_journal -m 0.1 -E stride=32,stripe-width=64 /dev/vgssd/lvssd
<syntaxhighlight lang=bash>
# tune2fs -c 0 /dev/vgssd/lvssd</pre>
# mkfs.ext4 -v -O ^has_journal -m 0.1 -E stride=32,stripe-width=64 /dev/vgssd/lvssd
# tune2fs -c 0 /dev/vgssd/lvssd
</syntaxhighlight>
 
=== Back to installer ===
* When partitioner comes up, use the already created /dev/vgssd/lvssd as / **do not format, ruins the purpose of removing the journal and adding stride/stripe-width for alignment purposes.


== Post Install Before Reboot ==
== After install is finished, but before Reboot ==
=== Add bits for lvm and nfs on next boot ===
=== Add bits for lvm and nfs on next boot ===
<pre># mount -o bind /dev /target/dev
* Jump back to a tty
<syntaxhighlight lang=bash>
# mount -o bind /dev /target/dev
# mount -o bind /sys /target/sys
# mount -o bind /sys /target/sys
# mount -o bind /proc /target/proc
# mount -o bind /proc /target/proc
# chroot /target
# chroot /target
# sudo apt-get install lvm2 nfs-common</pre>
# sudo apt-get -y install lvm2 nfs-common
</syntaxhighlight>


=== /etc/fstab modifications ===
=== /etc/fstab modifications ===
<pre>UUID="6239bc41-8816-47b6-b7d5-2be592f8b69b" /              ext4    noatime,discard,errors=remount-ro 0 1
<syntaxhighlight lang=bash>
UUID="6239bc41-8816-47b6-b7d5-2be592f8b69b" /              ext4    noatime,discard,errors=remount-ro 0 1


# Keep excessive writes in /tmp, and I use a remote syslog server
# to reduce wear on ssd keep excessive writes in /tmp and use a remote syslog server
none /tmp tmpfs size=300M 0 0
none /tmp tmpfs size=300M 0 0
none /var/log tmpfs defaults 0 0
none /var/log tmpfs defaults 0 0
Line 40: Line 75:
# Mount network raid array and lets keep apt cache over there via bind mount
# Mount network raid array and lets keep apt cache over there via bind mount
192.168.1.20:/mnt/raid5 /mnt/raid5 nfs defaults 0 0
192.168.1.20:/mnt/raid5 /mnt/raid5 nfs defaults 0 0
/mnt/raid5/drew/drew-desktop/archives/ /var/cache/apt/archives/ nfs bind 0 0</pre>
/mnt/raid5/drew/drew-desktop/archives/ /var/cache/apt/archives/ nfs bind 0 0
</syntaxhighlight>


=== /etc/rc.local additions ===
=== /etc/rc.local additions ===
<pre>echo deadline >/sys/block/sdg/queue/scheduler
<syntaxhighlight lang=bash>
echo deadline >/sys/block/sdg/queue/scheduler
echo deadline >/sys/block/sdh/queue/scheduler
echo deadline >/sys/block/sdh/queue/scheduler
find /sys/devices -name nr_requests -exec sh -c 'echo 4096 > {}' \;</pre>
find /sys/devices -name nr_requests -exec sh -c 'echo 4096 > {}' \;
</syntaxhighlight>


=== /etc/sysctl.conf additions for swap===
=== /etc/sysctl.conf additions for swap===
<pre>vm.swappiness to 1</pre>
<syntaxhighlight lang=bash>
vm.swappiness to 1
</syntaxhighlight>


=== Update grub2 ===
=== Update grub2 ===
* Note may require rebuild of initial ram disk -
* Note may require rebuild of initial ram disk -
<pre># mv /boot/initrd.img-3.2.0-20-generic initrd.img-3.2.0-20-generic.old
<syntaxhighlight lang=bash>
# mv /boot/initrd.img-3.2.0-20-generic initrd.img-3.2.0-20-generic.old
# mkinitramfs -o /boot/initrd.img-3.2.0-20-generic
# mkinitramfs -o /boot/initrd.img-3.2.0-20-generic
# update-grub
# update-grub
# grub-install /dev/sda
# grub-install /dev/sda
# grub-install /dev/sdb</pre>
# grub-install /dev/sdb
</syntaxhighlight>


== Reboot from Installer ==
== First boot into installed OS ==
Once in OS lets stop a few things from wearing out the SSD's.
Once in OS lets stop a few things from wearing out the SSD's.



Latest revision as of 13:16, 26 February 2018

Ubuntu RAID0 SSD no root w/o boot partition

Start install media

Jump over to another tty

# apt-get -y install lvm2

Make sure partition starts on 2048

# fdisk -l

Disk /dev/sda: 32.0 GB, 32017047552 bytes
132 heads, 63 sectors/track, 7519 cylinders, total 62533296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000a5046

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    62533295    31265624   8e  Linux LVM

Disk /dev/sdb: 32.0 GB, 32017047552 bytes
132 heads, 63 sectors/track, 7519 cylinders, total 62533296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xd67db81c

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048    62533295    31265624   8e  Linux LVM

Create PV's with aligned metadata

# pvcreate --metadatasize 250k /dev/sda1
# pvcreate --metadatasize 250k /dev/sdb1

Create VG and LV

# vgcreate  vgssd /dev/sda1 /dev/sdb1
# vgdisplay vgssd | grep Total
  Total PE              15266
# lvcreate -i2 -I128 -n lvssd vgssd --extents 15266

Create file system

# mkfs.ext4 -v -O ^has_journal -m 0.1 -E stride=32,stripe-width=64 /dev/vgssd/lvssd
# tune2fs -c 0 /dev/vgssd/lvssd

Back to installer

  • When partitioner comes up, use the already created /dev/vgssd/lvssd as / **do not format, ruins the purpose of removing the journal and adding stride/stripe-width for alignment purposes.

After install is finished, but before Reboot

Add bits for lvm and nfs on next boot

  • Jump back to a tty
# mount -o bind /dev /target/dev
# mount -o bind /sys /target/sys
# mount -o bind /proc /target/proc
# chroot /target
# sudo apt-get -y install lvm2 nfs-common

/etc/fstab modifications

UUID="6239bc41-8816-47b6-b7d5-2be592f8b69b" /               ext4    noatime,discard,errors=remount-ro 0 1

# to reduce wear on ssd keep excessive writes in /tmp and use a remote syslog server
none		/tmp		tmpfs	size=300M	0 0
none		/var/log	tmpfs	defaults	0 0

# Mount network raid array and lets keep apt cache over there via bind mount
192.168.1.20:/mnt/raid5 /mnt/raid5	nfs	defaults	0 0
/mnt/raid5/drew/drew-desktop/archives/ /var/cache/apt/archives/	nfs	bind 0 0

/etc/rc.local additions

echo deadline >/sys/block/sdg/queue/scheduler
echo deadline >/sys/block/sdh/queue/scheduler
find /sys/devices -name nr_requests -exec sh -c 'echo 4096 > {}' \;

/etc/sysctl.conf additions for swap

vm.swappiness to 1

Update grub2

  • Note may require rebuild of initial ram disk -
# mv /boot/initrd.img-3.2.0-20-generic initrd.img-3.2.0-20-generic.old
# mkinitramfs -o /boot/initrd.img-3.2.0-20-generic
# update-grub
# grub-install /dev/sda
# grub-install /dev/sdb

First boot into installed OS

Once in OS lets stop a few things from wearing out the SSD's.

Move Firefox cache off ssd

  • firefox-> about:config -> new string -> browser.cache.disk.parent_directory to /tmp/drewff

Sources