Skip to content

Latest commit

 

History

History
513 lines (386 loc) · 13.3 KB

linux_SSD.md

File metadata and controls

513 lines (386 loc) · 13.3 KB

SSD tablets & laptops

written by Nick Shin - [email protected]
this file is licensed under: Unlicense - http://unlicense.org/
and, is from - https://github.com/nickshin/CheatSheets/


Surface Pro 3 issues

Ubuntu MATE 16.04 - works mostly
Ubuntu Studio 16.04 - will bomb on grub installation

NOTE: just in case grub doesn't stick: follow these wonderful instructions to fix it



prep USB stick

dd bs=4M if=ubuntu-mate-16.04-desktop-amd64.iso of=/dev/sdX


multiboot USB

i like to test grub configurations first "virtually" on my desktop (much faster) before burning the copies to the USB stick (much slower)...

target "device"

[ disk image ]
# 30MB test image - using dummy iso files for testing grub.conf scripts
dd if=/dev/zero of=disk.img bs=1M count=30
DEVICE=disk.img
[ thumb stick ]
DEVICE=/dev/sdX    # your USB stick

create partitions

gdisk $DEVICE
	o
		Y
	n   # BIOS boot - partition #1
		[enter]
		[enter]
		2MiB
		EF02
	n   # EFI System - partition #2
		[enter]
		[enter]
		10MiB   # check with your system: sudo du -cks /boot/efi
		EF00
	n   # your data - partition #3
		[enter]
		[enter]
		[enter]
		[enter]
	r
	h
	1 2 3
	N
	# GPT partition 1
		[enter]
		N
	# GPT partition 2
		[enter]
		N
	# GPT partition 3
		[enter]
		Y
	x
	h
	w
	Y

# or in a single command:
parted --script $DEVICE \
	mklabel gpt \
	mkpart primary fat32 1 128 \
	mkpart primary fat32 1 128 \
	mkpart primary fat32 1 128 \
	set 1 boot on

format partitions

[ disk image ]
sudo apt-get install kpartx    # to create device maps from partition tables
sudo kpartx -l $DEVICE         # list existing partition mapping
sudo kpartx -av $DEVICE        # add partition mapping

sudo mkfs.vfat /dev/mapper/loop0p2
sudo mkfs.ext4 /dev/mapper/loop0p3
mkdir efi mnt
sudo mount /dev/mapper/loop0p2 efi
sudo mount /dev/mapper/loop0p3 mnt
sudo mkdir -p mnt/boot/iso
[ thumb stick ]
sudo mkfs.vfat /dev/sdX2
sudo mkfs.ext4 /dev/sdX3
mkdir efi mnt
sudo mount /dev/sdX2 efi
sudo mount /dev/sdX3 mnt
sudo mkdir -p mnt/boot/iso

grub-install

sudo apt-get install grub-efi-amd64 grub-pc-bin qemu
	# grub-efi-amd64 yields target: x86_64-efi
	# grub-pc-bin qemu yields target: i386-pc

the following can be done either/or (UEFI or BIOS boot) -- as well as, in this order (hybrid UEFI GPT + BIOS GPT/MBR boot):

sudo grub-install --removable --recheck \
				--no-nvram --efi-directory=./efi \
				--boot-directory=./mnt/boot --target=x86_64-efi

sudo grub-install --removable --recheck \
				--no-floppy \
				--boot-directory=./mnt/boot --target=i386-pc \
				/dev/loop0
  • mnt/boot/grub is created
  • NOTE: --{efi,boot}-directory can be relative to where the command is run

add grub/iso files

sudo cp -duvpr grub mnt/boot/.
[ disk image ]
# repeat for however many iso files listed in grub.conf
echo dummy | sudo tee mnt/boot/iso/distro_XYZ.iso
[ thumb stick ]
sudo cp -duvpr iso mnt/boot/.

linux ISOs


clean up

sudo umount efi
sudo umount mnt
sudo kpartx -d $DEVICE

rinse and repeat (disk image centric)

sudo kpartx -av disk.img ; sudo mount /dev/mapper/loop0p3 mnt
sudo cp -duvpr grub mnt/boot/.
sudo umount mnt; sudo kpartx -d disk.img
qemu-system-i386 -machine accel=kvm:tcg disk.img -serial stdio
qemu-system-x86_64 -enable-kvm -bios bios.bin disk.img


SSD

no acccess time

sudo vi /etc/fstab
  • NOTE: noatime,nodiratime,discard
/dev/sdbX / ext4 noatime,nodiratime,discard,errors=remount-ro 0 1
tmpfs /tmp tmpfs defaults 0 0
tmpfs /var/tmp tmpfs defaults 0 0

deadline scheduler

cat /sys/block/sdX/queue/scheduler
	### ensure [deadline] is used
	### see External Resources links below for details

swappiness

cat /proc/sys/vm/swappiness
	### make sure it is less than 10
	### 1 is ok, 0 disables swap...

sudo vi /etc/sysctl.conf
	### lower swappieness setting
	### vm.swappiness=1

check health

sudo smartctl -data -A /dev/sdX
  • value starts at 100
    • replace/backup drive at 10 or below
    • replace/backup drive at 10 or below
    • replace/backup drive at 10 or below


Screen

DPI

sudo vi /etc/X11/xinit/xinitrc
  • add EOF
	# ASUS UX305c
	# 1920x1080 13.3"
	xrandr --dpi 166/eDP1
	
	# Microsoft Surface Pro 3
	# 2160×1440 12"
	xrandr --dpi 216/eDP1

Surface Pro 3

there are 2 ways to control the brightness

  • xrandr
# obtain display
xrandr -q | grep " connected" | awk '{ print $1; }'

# use the display to set the brightness (e.g. eDP1)
xrandr --output eDP1 --brightness 0.5
  • xbacklight
sudo apt install backlight
xbacklight -inc 20     # increase backlight by 20%
xbacklight -dec 30     # decrease by 30%
xbacklight -set 80     # set to 80% of max value
xbacklight -get        # get the current level
- bind (inc/dec) commands to keyboard hotkeys

- and, add the "Brighness Controller" app to the panel
  • Note: xrandr will set the overall system brightness. xbacklight will be relative to that.


Pointer

Touchpad

  • System Settings -> Mouse and Touchpad
    to change several settings including:
    • enabling two finger scrolling
    • also, three and four finger touch gestures works

Surface Pro 3

sudo vi /usr/share/X11/xorg.conf.d/10-evdev.conf
  • add EOF
Section "InputClass"
	Identifier "Surface Pro 3 cover"
	MatchIsPointer "on"
	MatchDevicePath "/dev/input/event*"
	Driver "evdev"
	Option "vendor" "045e"
	Option "product" "07dc"
	Option "IgnoreAbsoluteAxes" "True"
EndSection
  • TODO: find out how to get (surface pro 3) touchpad option to show up in [ System Settings -> Mouse ]


Power Management

TODO: LEFT OFF HERE..
TODO: LEFT OFF HERE...
TODO: LEFT OFF HERE...


External Resoures

SSD

devices

multiboot USB


depricated (surface pro 3) resources

these instructions are no longer needed...
left here for reference just in case system recovery is needed
(for example) to run firmware updates

download a recovery image

have windows partition

do updates and then create a recovery stick

boot recovery stick

boot linux UEFI stick