Chapter 3
Video 2: Section 101.1 - Hardware Settings
- HAL (Hardware Abstraction Layer)
- Identifies a device by what is does
- Ethernet card = eth0
- DBUS
- Communication with hardware and software
- Hey, i found a usb device, what do you want to do with it
- UDEV
- When a device is connected it is automatic assigned to /dev/sda
- The UDEV recognises the device type and makes it /dev/camera
- SYSFS (/sys)
-
- Proc Filesystem (/proc)
- Created in RAM when the computer boots
- When you change things in /proc you can read/write but only temporary
- Must be root
- The numbers are PID (proces-ID`s)
- File cpuinfo gives info about the cpu
- File mounts gives info about the mounted file systems
- Make permanent changes in /etc/sysctl.conf
- See all things mounted in /proc/mounts
- Dev directory (/dev)
- sr0 = serial
- sda = sata
- UDEV creates a link: sr0 > cdrom
- Show kernel modules
- # lsmod
- Show PCI devices
- # lspci
- Show USB devices
- # lsusb
- Show different parts of linux
- #lspcmcia (PCMCIA)
- #lshal (HAL)
- #lshw (Hardware)
- Remove a kernel module
- # rmmod {module}
- Searches for dependencies for modules, and installs them
- # modprobe {module}
- Automaticly installs the driver on boot up
- Device ID - UUID
- In /proc/mounts the UUID of a device is connected to a /dev directory
- Hot-plug
- Adding/removing devices when computer is on
- Cold-plug
- Adding/removing devices when computer is off
Video 5: Section 102.1 - Hard Disk Layout
- Linux is flexible as how you design the file system
- Partitons
- /boot/ = Contains information about the system for boot
- / = Root.
- /home/ = User files are stored here
- /var/ = Contains data of programs (webserver, logs etc)
- /opt/ = Third Party stuff
- /usr/ = Binary programs are stored here (ls, apache)
- swap = Virtual memory, used when ram is full (is 1x/2x RAM space)
- Linux mounts partitions as folders, or it lives in the root system
- Some partitions can be mounted trough network or be stored on other drives
Video 18: Section 104.1 - Create Partitions and Filesystems
- List all the drives and partitions in the computer
- # fdisk -l
- Select a (empty) drive to edit that furhter
- # fdisk {drive}
- {drive} = /dev/sda
- Use commands to edit the drive
- m = help
- p = show drive specifications (make sure it is not the wrong drive)
- n = add a new partition
- e = extended partition
- p = primary partition (choose this)
- Choose partition number
- Enter cylinder number to start the partition
- Enter cylinder number/size to end the partition
- Use +cylinders to select a end cylinder
- Use +size to select a size
- t = change a partition system id (type of partition)
- L = list the codes
- 83 = linux
- 82 = swap/solaris
- w = write the new partition table to the drive
- Create a swap file system from a existing partition
- # mkswap {partition}
- {partition} = /dev/sdb2
- List all the swapspace available
- # swapon -s
- Create a filesysyetem from a existing partition
- # mkfs {options} {filesysyem} {partition}
- [ -t ] = type
- {filesysytem} = ext2, ext3, reiserfs, vfat (windows)
- # mkfs.{filesystem} {options} {partition}
- [ -f ] = force change
Video 19: Section 104.2 - Maintain the integrity of file-systems
- EXT1/EXT2 are normal filesystems, EXT3 is a journaled filesystem
- Shows which file system is mounted where and how much space is used
- # df {options}
- [ -h ] = Human readable (in GB/MB etc)
- [ -i ] = Shows inode usage
- Every inode is created per file, so total inodes is total files
- Journal file systems take up space
- Display how much space each folders takes up
- # du {options} {directory}
- [ -h ] = Human readable (GB/MB)
- [ --summarize ] = Goes one level and displays total space consumed per folder
- Check a file system
- # fsck {options} {filesystem} {partition)
- [ -t ] = Force a file system type
- It identifies the file system that is used and uses the appropriate tool
- # fsck.{filesystem} {partition}
- Check a XFS filesystem
- # xfs_check {partition}
- Repair a XFS filesystem
- # xfs_repair {partition}
- Check a ext2/ext3 filesystem
- # e2fsck {partiton}
- Repair a filesystem using special tools
- # debugsf {options} {partition}
- [ -w ] = Make changes to the partition
- lsdel = shows deleted files
- undel {id} {filename} = repair a deleted file
- See information of a ext filesystem
- # dumpe2fs {filesystem}
- Tune a filesystem
- # tune2fs {options} {partiton}
- Information about the filesystem
- # xfs_info {partition}
- Only works if mounted
- Create a dump from a xfs filesystem
- # xfs_metadump {partion} FILE.txt
Video 20: Section 104.3 - Mounting and unmounting filesystems
- Mount a device
- # mount {options} {partiton} {mountlocation}
- [ -t ] = Specify filesystem (oa ext3)
- {partion} = /dev/sdb1
- {mountlocation} = /mnt/hard_drive (map must be empty, can be anywhere)
- Program without options/arguments prints all the mounted drives
- Program without options/partitions checks the fstab file for info
- Unmount a mounted device
- # umount {partion/mountlocation}
- Can only be unmounted when it is not in use
- Make the drive mount at startup
- /etc/fstab file
- File is ordered in different colums
- <file system>
- Use UUID=... OR /dev/... OR label=...
- <mount point>
- Point where the device need to be mounted
- <type>
- Filesystem (udf, auto (detect filesystem automaticly), ext3 etc)
- <options>
- Different options for the device.
- [ defaults ] = default settings
- [ rw ] = read/write
- [ user ] = any user will be able to mount and unmount filesystems
- [ auto ] = automaticly mount the drive on bootup
- [ noexec ] = no binary programs can be run from the device
- <dump>
- 0 OR 1, automatic saves files on shut down when 1
- <pass>
- Order in which the devices are scanned
- Standard: root device is 1, removable devices is 0
- Removable media is standard mounted in the /media/... folder (floppy/cd)