Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
187 lines (159 sloc) 7.01 KB
The Three Giants of Linux -
The Linux Distribution Diagram -
List of supported architectures -
History of Linux -
Linux kernel internals structure - additional/GNU_Linux_OS_internals.png
How to find help in Linux
1. -h / --help
2. man command/filename
3. info command/filename
4. /usr/doc
5. If man and/or info are not available on your machine, you can always google for the command or serarch for manual pages here:
6. The Linux Documentation Project -
7. The Linux Kernel Documentation directory - Documentation/* (
8. HowToForge -
HardDisk names
| |\--- 1-x - partition numbers
| |---- a - primary master
| |---- b - primary slave
| |---- c - secondary master
| \---- d - secondary slave
\------ hd - IDE hard disk or CDROM
| |\--- 1-x - partition numbers
| \---- a-z - device name
\------ sd - SCSI/SATA/SAS/USB hard disk
| | \--- 1-x - partition numbers
| \----- 0-x - device sequence number
\--------- device name (only SD/MMC compatible cards)
Memory sticks are usually read via USB card readers which expose them as USB hard disks
*** Everything is custom ***
!!! Always keep /boot on a separate partition and make it between 150-500 MB !!!
Swap considerations:
1. If you have less than 2GB of RAM, create the swap partition at least as big as the amount of RAM.
2. If you have less than 1GB of RAM, create the swap to be double the amount of RAM.
3. If you have above 4GB of RAM and you are not going to use Hibernate either remove the swap completely or don't make it bigger than 1GB.
4. If you are going to use Hibernate, then you need the swap partition to be as big as your ram is + 10-20 MB, no matter how much RAM you have.
5. Swap can be dispersed across multiple devices in order to increase its performance. If two or more swap partitions have the same priority(for example, pri=0), then the kernel writes to them on round-robin basis.
General partition scheme:
0 - for swap - take a look at Swap considerations
1 - for /boot - 150-500 MB
2 - for / - the rest of the space
Two possible schemes for resize have to be considered:
1. Leave the biggest partition at the end,
2. Leave the biggest partition at the beginning.
Never put the biggest partition between the others. If you resize it later, you will need to move some partitions to be able to utilize the freed space.
Should you use Linux Software RAID ?
Should you use LVM ?
Considerations for Linux Software RAID
1. Redundancy
2. Portability
3. Strange performance setups (/dev/ram0 /dev/sdb1 where sdb1 is setup as --write-mostly)
4. You have to think carefully before creating the md devices in order to prevent block unalignment issues(which cause performance issues).
Considerations for LVM
1. You can resize, delete, create partitions without many issues.
2. You can easily expand your volume groups by adding new drives.
3. It becomes harder to recover broken data
4. You have to think carefully before creating the volume groups and logical volumes in order to prevent block unalignment issues(which cause performance issues).
5. LVM is the only good backup solution for MySQL/PgSQL servers. Everything else is cluster/replication based or needs service interruption.
Do not put Linux Software RAID on top of LVM and the other way around. This causes performance issues.
Unfortunately I can't tell you which mirroring code is faster. I personally prefer the SW RAID1, but it is possible that the LVM code is faster. I don't know.
Considerations for primary/logical partitions
1. Primary partitions are only 4, so you can not scale, with more partitions.
2. Some operating systems can not boot from logical partitions.
3. The logical partitions can be theoretically infinite.
Considerations for the size of the partitions
1. Bigger partitions take longer time to backup and restore.
2. If you are planning to have HUGE amount of files, but they are small, then you can sacrifice some space to allocate more inodes(tweaking the inode options of the selected FS).
3. If the partitions are small, they can not contain many files. Also, bigger separation of the data can slow down your hard drive. And finally at some point you may need to expand them or combine them with other partitions.
4. Very big partitions over 16TB limit you to only a few types of File Systems.
5. Linux I/O queues are per device, not per partition. Which means that more partitions on the same device is worse then partitions on separate physical devices.
6. If you are using HW RAID controllers, sometimes it is better to export two separate devices from your array instead of one(because of the above rule).
Directory structure considerations
1. /home usually grows a lot because of all the user content
2. /usr also grows, usually because of a lot of new software
3. /var grows because of logs, databases or e-mails going through the SMTP server
What kind of pseudo file systems we have:
- ProcFS
+ /proc/cpuinfo
+ /proc/meminfo
+ /proc/partitions
+ /proc/filesystems
+ /proc/schedstat
+ /proc/diskstats
+ /proc/loadavg
+ /proc/uptime
- SysFS
+ /sys/class/thermal/thermal_zone0/temp
+ /sys/power/disk
+ /sys/bus/cpu/devices/cpu0/cpufreq/cpuinfo_cur_freq
- TmpFS
+ block distribution
File systems can be created on a partition or on a file.
Files that we need to look at:
- /proc/partitions
- /proc/mounts
- /proc/filesystems
- /etc/fstab
- /etc/mtab
Commands that we need to look at:
- mknod
- fdisk
- cfdisk
- sfdisk
- parted
- mkswap
- swapon/swapoff
- mkfs.ext2/3/4
- mkfs.reiserfs
- mkfs.vfat
- tune2fs
- dd
- mount
- sync
- echo 0/1/2/3 > /proc/sys/vm/drop_caches (Documentation/sysctl/vm.txt)
+ 0 - do nothing
+ 1 - free pagecache
+ 2 - free directory entries and inodes
+ 3 - free pagecache, directory entries and inodes
- fsck.*
+ /lost+found
+ e2fsck
Cluster/Network file systems
- NFS (mount & export)
- CIFS (smbmound/mount -t cifs)
Commands setup:
1. create devices with mknod
2. create/edit/delete partitions with cfdisk
3. create/edit/delete partitions with fdsisk
4. create/edit/delete partitions with sfdisk
5. create/edit/delete partitions with parted
6. create swap fs on a partition
7. create swap fs on a file
8. activate, deactivate and monitor swaps
9. create an ext3 fs on a partition
10. create an ext2 fs on a file
11. create reiserfs fs on a partition
12. create vfat fs on a partition
13. make a backup of your MBR using dd
14. convert ext2fs to ext3 with tune2fs
15. create, modify and delete sw raid with mdadm
16. create, modify and delete LVM partitions
17. mount the created partitions
18. describe the definitions of /etc/fstab and mtab
19. show mount --bind/--rbind
20. describe the following mount options:
+ noatime/nodiratime
+ auto/noauto
+ owner
+ nosuid
+ nodev
+ noexec
+ remount
+ nofail
+ usrquota/grpquota (moved to FS meta data)
21. mounting a file using loop
You can’t perform that action at this time.