UbuntuRAID0ssd: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Ubuntu RAID0 SSD no root w/o boot partition == During install == === Jump over to another tty === <pre># apt-get install lvm2</pre> === Make sure partition starts on 2048 ==...") |
|||
(6 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 | ||
== | == Start install media == | ||
=== Jump over to another tty === | === Jump over to another tty === | ||
< | <syntaxhighlight lang=bash> | ||
# apt-get -y install lvm2 | |||
</syntaxhighlight> | |||
=== Make sure partition starts on 2048 === | === Make sure partition starts on 2048 === | ||
< | <syntaxhighlight lang=bash># fdisk -l | ||
=== Create PV's | Disk /dev/sda: 32.0 GB, 32017047552 bytes | ||
< | 132 heads, 63 sectors/track, 7519 cylinders, total 62533296 sectors | ||
# pvcreate --metadatasize 250k /dev/sdb1</ | 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 === | |||
<syntaxhighlight lang=bash> | |||
# pvcreate --metadatasize 250k /dev/sda1 | |||
# pvcreate --metadatasize 250k /dev/sdb1 | |||
</syntaxhighlight> | |||
=== Create VG and LV === | === Create VG and LV === | ||
< | <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</ | # lvcreate -i2 -I128 -n lvssd vgssd --extents 15266 | ||
</syntaxhighlight> | |||
=== Create file system === | === Create file system === | ||
< | <syntaxhighlight lang=bash> | ||
# tune2fs -c 0 /dev/vgssd/lvssd</ | # 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. | |||
== 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 === | ||
< | * 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 | # sudo apt-get -y install lvm2 nfs-common | ||
</syntaxhighlight> | |||
=== /etc/fstab modifications === | === /etc/fstab modifications === | ||
< | <syntaxhighlight lang=bash> | ||
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 /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</ | /mnt/raid5/drew/drew-desktop/archives/ /var/cache/apt/archives/ nfs bind 0 0 | ||
</syntaxhighlight> | |||
=== /etc/rc.local additions === | === /etc/rc.local additions === | ||
< | <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 > {}' \;</ | find /sys/devices -name nr_requests -exec sh -c 'echo 4096 > {}' \; | ||
</syntaxhighlight> | |||
=== /etc/sysctl.conf additions for swap=== | === /etc/sysctl.conf additions for swap=== | ||
< | <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 - | ||
< | <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</ | # grub-install /dev/sdb | ||
</syntaxhighlight> | |||
== First boot into installed OS == | |||
Once in OS lets stop a few things from wearing out the SSD's. | |||
== Move Firefox cache off ssd == | === Move Firefox cache off ssd === | ||
* firefox-> about:config -> new string -> browser.cache.disk.parent_directory to /tmp/drewff | * firefox-> about:config -> new string -> browser.cache.disk.parent_directory to /tmp/drewff | ||
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
- https://sites.google.com/site/lightrush/random-1/checkiftrimonext4isenabledandworking
- http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/newmds-ssdtuning.html
- http://www.ocztechnologyforum.com/forum/showthread.php?82648-software-RAID-LVM-TRIM-support-on-Linuxking
- http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/newmds-ssdtuning.html
- https://wiki.archlinux.org/index.php/Solid_State_Drives#Mount_Flags