Unadorned links for February 14, 2017 😍

This is the unformatted notes....

Finishing off last week

A little exercise with initrd
  cd /var/tmp
  mkdir initrd
  cd initrd
  gunzip < /boot/initrd.img-3.13.0-100-generic | cpio -id
  du -s *
Take a look at
   bin directory
     what is busybox?
   init shellscript
     it will call /bin/run-init to run /sbin/init
   It is process #1

https://en.wikipedia.org/wiki/Init
https://en.wikipedia.org/wiki/Systemd
https://www.digitalocean.com/community/tutorials/understanding-systemd-units-and-unit-files

systemd is the future — (it spite of the screaming)
  Fedora (2011), Red Hat (2014), Debian/Ubuntu/Raspbian (2015)
  Still many System V compatiability modes

Connect to eastatoe.cs.unca.edu and look at /lib/systemd/services

Devices – Chapter 3

mknod

/proc/devices

https://github.com/torvalds/linux/tree/master/drivers
https://github.com/torvalds/linux/blob/master/drivers/char/mem.c
   Look for read_null and write_null and null_lseek and null_fops
   similarly for zero_fops and full_fops
and memdev structure (l 806)
https://github.com/torvalds/linux/blob/master/drivers/char/random.c


cat /dev/zero
echo foo > /dev/zero
echo foo > /dev/null
cat /dev/null
dd if=/dev/zero of=zero.chars bs=1000 count=1

ls -l /dev | grep " 1,"

/proc/filesystems
     https://github.com/torvalds/linux/tree/master/fs/sysfs
  /sys   —   sysfs
  /proc  —   procfs
    debugfs    — /sys/kernel/debug
    devpts     — /dev/pts


Take a look at /sys — the sys filesystem

In /sys/bus
   WHAT ARE THEY....
   acpi
   i2c

What is /sys/fs
  cgroup, ecryptfs, ext4, fuse, pstore
What is /sys/module

What is a block vs character device?
    block devices may "cache" blocks in RAM
    take a look at the "top" command
What is a bus?
    What are all the buses (in /sys/bus)



Look at Section 3.4

What are the disks on your system

Try
   lsscsi
       https://en.wikipedia.org/wiki/SCSI_command
       http://www.seagate.com/staticfiles/support/disc/manuals/Interface%20manuals/100293068c.pdf
   SCSI addresses by LBA not CHS
       https://en.wikipedia.org/wiki/Cylinder-head-sector


What does this mean?
  /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-2/2-2:1.0/host12/target12:0:0/12:0:0:0/block/sdc
    What is the northbridge and southbridge
  Intel 4 Series Chipset
    http://www.intel.com/content/www/us/en/processors/xeon/4-chipset-family-datasheet.html
  Intel Z270 chipset
    http://ark.intel.com/products/98089/
    http://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-datasheet-vol-1.html

Back to USB — what does the name mean?
    http://www.makelinux.net/ldd3/chp-13-sect-2

mknod create devices
    What can't ordinary users create devices?
    Why aren't devices allowed on USB drives?

Section 3.5  — by the book
    In the old days, you didn't add devices to running systems

lsusb
    What is that device?  (vendor + class)
        https://usb-ids.gowdy.us

udev — dynamic device management
    man udev
    /etc/udev/rules.d/

udevadm  — may need a USB device
    udevadm info —query=all —name=/dev/sda
    udevadm monitor
        Look at udev-out.txt

Look at Figure 3-2    

Disks, partitions, and file systems — Chapter 4

Why partitions?
    http://www.digitalcitizen.life/4-reasons-why-you-should-use-more-one-partition-your-pc
The MBR (Master Book Record) world
    Primary partitions — up to 4
    Extended partition — 1 special primary partition
    Logical partitions — a division of an extended partition
The GPT (Globally unique identifier Partition Table)
Other stuff —-
    lvm — logical volume manager (look at the lab computer)
        https://en.wikipedia.org/wiki/Logical_Volume_Manager_(Linux)
    hardware RAID — on the server computers
    software RAID
    ZFS and AdvFS (defunct)
        https://en.wikipedia.org/wiki/ZFS
        https://en.wikipedia.org/wiki/AdvFS

Try out the Raspberry Pi
    sudo /sbin/fdisk /dev/mmcblk0 
        Do not WRITE!
A partition exercise — Two year’s ago
    DANGER. DANGER.
    YOU MUST WATCH ME...