Linuxã®ä»çµã¿ãŸãšã
ðOSãšããŠã®æè¡ã«ã€ããŠ.
The Boot Process
BIOS æ¹åŒãš UEFI æ¹åŒããã.äž¡è ã¯ããªãããšãªã£ãŠãã.
Arch Boot Process (æ¥æ¬èª) - ArchWiki
BIOS
MBR
ãã¹ã¿ãŒããŒãã¬ã³ãŒã (MBR) ã¯ã¹ãã¬ãŒãžããã€ã¹ã®æåã® 512 ãã€ãã®ããš
the boot loader resides at the first sector of the hard disk .
OS ã®ããŒãããŒããšã¹ãã¬ãŒãžããã€ã¹ã®ããŒãã£ã·ã§ã³ããŒãã«ã®ããã«äºçŽãããé å.
BIOS æ¹åŒ
BIOS -> MBR (Assembly Code) -> Boot loader -> Linux Kernel
- ã·ã¹ãã ã®é»æºãå ¥ããã POST ãå®è¡ããã
- BIOS ãããŒãã«å¿ èŠãªã·ã¹ãã ããŒããŠã§ã¢ (ãã£ã¹ã¯ãããŒããŒãã³ã³ãããŒã©ãªã©) ãåæåãã
- (BIOS ã®ãã£ã¹ã¯é ã§) æåã®ãã£ã¹ã¯ã®æåã® 440 ãã€ã (Master Boot Record) ã BIOS ã«ãã£ãŠå®è¡ããã
- BIOS ãã MBR ããŒãã³ãŒãã«ã³ã³ãããŒã«ã移ã, 次ã®ã¹ããŒãžã®ã³ãŒããèµ·åãã (éåžžã¯ããŒãããŒããŒã®ã³ãŒã)
- èµ·åãã (2 çªç®ã®) ã³ãŒã (ããŒãããŒããŒ) ã¯ãµããŒããšèšå®ãã¡ã€ã«ãèªã¿èŸŒã
- èšå®ãã¡ã€ã«ã®ããŒã¿ã«åºã¥ã, ããŒãããŒããŒã¯ã«ãŒãã«ãš initramfs ãã·ã¹ãã ã¡ã¢ãª (RAM) ã«ããŒãããŠã«ãŒãã«ãèµ·åãã
UEFI æ¹åŒ
-
ã·ã¹ãã ã®ã¹ã€ãããå ¥ã - POST (Power On Self Test) ããã»ã¹
-
UEFI ãã¡ãŒã ãŠã§ã¢ãããŒããããŸã. ãã¡ãŒã ãŠã§ã¢ã¯èµ·åã«å¿ èŠãªããŒããŠã§ã¢ãåæåããŸã
-
次ã«ãã¡ãŒã ãŠã§ã¢ã¯ããŒããããŒãžã£ã®ããŒã¿ãèªã¿èŸŒã¿ã©ã® UEFI ã¢ããªã±ãŒã·ã§ã³ãã©ããã (ã€ãŸãã©ã®ãã£ã¹ã¯ã»ããŒãã£ã·ã§ã³ãã) èµ·åããã決å®ããŸã
-
ãã¡ãŒã ãŠã§ã¢ã®ããŒããããŒãžã£ã®ããŒããšã³ããªã«å®çŸ©ãããŠããããã« UEFI ã¢ããªã±ãŒã·ã§ã³ããã¡ãŒã ãŠã§ã¢ãèµ·åããŸã
-
èµ·åãã UEFI ã¢ããªã±ãŒã·ã§ã³ã¯èšå®ã«ãã£ãŠä»ã®ã¢ããªã±ãŒã·ã§ã³ (UEFI ã·ã§ã«ã rEFInd ã®å Žå) ãã«ãŒãã«ãš initramfs (GRUB ãªã©ã®ããŒãããŒãã®å Žå) ãèµ·åããŸã
-
Unified Extensible Firmware Interface (æ¥æ¬èª) - ArchWiki
Boot loader
ããŒãããŒã㯠BIOS ã UEFI ã«ãã£ãŠèµ·åãããäžçªæåã®ãœãããŠã§ã¢.
-
Step1:(Init boot loader) Bootable Disk ã«æ ŒçŽãããŠãã Boot Sector ã, RAM äžã«èªã¿åºã.
-
Step2: /boot ã«æ ŒçŽãããŠãã Boot loader ãèªã¿åºã
Boot Sector ã®çš®é¡
- BIOS/MBR (æ§)
- EFI/UEFI (æ°)
Boot loader ã®çš®é¡
- GRUB GRUB (æ¥æ¬èª) - ArchWiki
- ISOLINUX
- sysLinux
ðLinux Kernel
Linuxã«ãããðKernel.
- ðALSA: ãªãŒãã£ãªã®ããã¡ã¯ãã¹ã¿ã³ããŒã.
The boot loader loads
- Linux kernel
- an initial RAM â based file system (initramfs)
into memory so it can be used directly by the kernel.
Kernel Module
ã«ãŒãã«ã¢ãžã¥ãŒã«, åã«ã¢ãžã¥ãŒã«ãšã.
Linuxã«ãŒãã«ã®æ©èœã®äžéšããã«ãŒãã«æ¬äœãšã¯å¥ã«ããŒããã¢ã³ããŒãã§ããããã«åé¢ãããµã€ãºã®å°ãããã€ããªãã¡ã€ã«.
modprobe
Linuxã«ãŒãã«ã«ã«ãŒãã«ã¢ãžã¥ãŒã«ãæåã§load/unloadããããã®CLI command.
initramfs
Linux ã«ãŒãã«ã®ããŒãæã«ãã䜿ãããäžæçãªãã¡ã€ã«ã·ã¹ãã ã®äžçš®.
initramfs filesystem image contains,
- programs
- binary files
that perform all actions needed to mount the proper root filesystem.
- mount proper roor filesystem
- providing kernel functionality
- device drivers for mass storage controllers with a facility (UDEV)
- locating the drivers they need to operate properly, and loading them.
- After the root filesystem has been found, it is checked for errors and mounted.
mount point ãžã®ããã€ã¹ã®ããŠã³ããå®äºããã, initramfs 㯠RAM äžããåé€ããã. ãã㊠init programm (/sbin/init) ãå®è¡ããã.
udev
ããããã©ã°ããã€ã¹ãæ¥ç¶ããéã«, ããã€ã¹ãã¡ã€ã«ãåçã«äœæããä»çµã¿. ããã€ã¹ãã¡ã€ã«ãšã¯ Linux ã«æ¥ç¶ãããŠããããã€ã¹ããã¡ã€ã«ãšããŠæ±ãããã®ãã¡ã€ã«ã§ã. ããã€ã¹ãã¡ã€ã«ã¯ã/dev ããã£ã¬ã¯ããªé äžã«é 眮ãããŸã.
udev (Userspace DEVice management) ã¯ããã€ã¹ã®æ¥ç¶ãæ€ç¥ (ã«ãŒãã«ããéç¥ããã) ããé, ããã€ã¹ãã¡ã€ã«ãåçã«äœæããŸã
init
init ã¯, UNIX ç³»ã·ã¹ãã ã®ããã°ã©ã ã®ã²ãšã€ã§ãã, ä»ã®å šãŠã®ããã»ã¹ãèµ·åãã圹ç®ãæã€. ããŒã¢ã³ãšããŠåäœã, äžè¬ã« PID 1 ãä»äžããã.
[tsu-nera]% ps -ax | ag init
1 ? Ss 0:00 /sbin/init
BSD ã¹ã¿ã€ã«ã® init
System V ã¹ã¿ã€ã«ã® init
- dmesg ã·ã¹ãã ã®èµ·åæã®ã¡ãã»ãŒãžã衚瀺.
- /proc/cmdline ã·ã¹ãã èµ·åæã«ããŒãããŒãããã«ãŒãã«ã«æž¡ããããã©ã¡ãŒã¿ã確èªããããšãåºæ¥ããã¡ã€ã«
- /var/log/messages ã·ã¹ãã ã®èµ·å tty.
ã©ã³ã¬ãã«
Linux ã®åäœã¢ãŒãã®ããšãã©ã³ã¬ãã«ãšãããŸã. çŸåšã®ã©ã³ã¬ãã«ã¯ init ãŸã㯠telinit ã³ãã³ãã§å€æŽããããšãåºæ¥ãŸã.
æžåŒã¯ä»¥äžã®ãšããã§ã.
init ã©ã³ã¬ãã«
telinit ã©ã³ã¬ãã«
0 | ã·ã¹ãã åæ¢ | |
---|---|---|
1 | ã·ã³ã°ã«ãŠãŒã¶ãŒã¢ãŒã | ãããã¯ãŒã¯ãããŒã¢ã³ãèµ·åãã, |
root 以å€ã®ãã°ã€ã³ãèš±å¯ããªã (泚 2) | ||
2 | ãã«ããŠãŒã¶ãŒã¢ãŒã | ãããã¯ãŒã¯ãèµ·åããªã (泚 3) |
3 | ãããã¯ãŒã¯æã®ãã«ããŠãŒã¶ãŒã¢ãŒã | éåžžã®ã¢ãŒã (泚 3) |
4 | æªäœ¿çš | |
5 | X11 | ã©ã³ã¬ãã« 3 + X ãã£ã¹ãã¬ã€ãããŒãžã£èµ·å |
6 | ã·ã¹ãã åèµ·å |
systemd
systemd 㯠Linux ã«ããã init ããŒã¢ã³ã®ä»£æ¿ã§ããSystem V ã¹ã¿ã€ã«ãš BSD ã¹ã¿ã€ã«ã®äž¡æ¹ããµããŒã
systemd (æ¥æ¬èª) - ArchWiki
Linux FileSystems
FileSystems ã®çš®é¡
- Conventional disk filesystems: ext2, ext3, ext4, XFS, Btrfs, JFS, NTFS, etc.
- Flash storage filesystems: ubifs, JFFS2, YAFFS, etc.
- Database filesystems
- Special purpose filesystems: procfs, sysfs, tmpfs, debugfs, etc.
partition
A partition is a logical part of the disk.
å·èµåº«ã«æ£ãããããã«, Disk ã«ã¯ããŒãã£ã·ã§ã³ããã.
Windows | Linux | |
---|---|---|
Partition | Disk1 | /dev/sda1 |
Filesystem type | NTFS/FAT32 | EXT3/EXT4/XFS⊠|
Mounting Parameters | DriveLetter | MountPoint |
Base Folder where OS is stored | C drive | / |
Filesystem Hierarchy Standard
Linux ãšä»ã® UNIX ç³»ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã§ã®äž»ãªãã£ã¬ã¯ããªãšãã®å 容ãå®ãããã®.
LVM
è«çããªã¥ãŒã ãããŒãžã£. UNIX ç³»ã®å€§èŠæš¡ã¹ãã¬ãŒãž/ ãã£ã¹ã¯ãããŒãžã¡ã³ãæ©èœ.
ç©ççãªèšæ¶ããã€ã¹ã®é å (ç©çããªã¥ãŒã :PV) ãè€æ°ãŸãšããŠã²ãšã€ã®å€§ããªä»®æ³çãªé å (ããªã¥ãŒã ã°ã«ãŒã:VG) ãšã, ããããä»®æ³çãªããŒãã£ã·ã§ã³é å (è«çããªã¥ãŒã :LV) ãåãåºãããšã§, åŸæ¥ã®ç©ççãªããŒãã£ã·ã§ã³ãçšããæ¹æ³ãããæè»ã«èšæ¶é åã管çããããšãã§ããããã«ããä»çµã¿.
ã¡ãªãã
- åçãã€èªåšã«ãã£ã¹ã¯ã®ããŒãã£ã·ã§ã³ãå€æŽã§ããä»çµã¿.
- åŸããç©çããªã¥ãŒã ãå ããããšãã§ãã.
- åçã«ãªãµã€ãºããããšãã§ãã
- ããŒãã£ã·ã§ã³ãè€æ°ã®ãã£ã¹ã¯ã«ãŸããã£ãŠäœæã§ãã.
- ã¹ãããã·ã§ããæ©èœãå©çšã§ãã.
ãã¡ãªãã
- RAID ã«æ¯ã¹ãŠãã£ã¹ã¯ã¢ã¯ã»ã¹æ§èœãåºãªã.
ç©çããªã¥ãŒã (PV:Physical Volume)
ç©ççãªããŒããã£ã¹ã¯ãããŒãã£ã·ã§ã³. pvcreate ã§äœæ.
ããªã¥ãŒã ã°ã«ãŒã (VG:Volume Group)
ç©çããªã¥ãŒã ãéããŠäœã, ä»®æ³çãªé å (ä»®æ³çãªããŒããã£ã¹ã¯ã®ãããªãã®ã ãšæã£ãŠããã§ã) vgcreate ã³ãã³ãã䜿çšããŠäœæ
è«çããªã¥ãŒã (LV:Logical Volume)
ããªã¥ãŒã ã°ã«ãŒãã®äžéš (ãŸãã¯å šéš) ã䜿ã£ãŠäœã, ä»®æ³çãªããŒãã£ã·ã§ã³. åŸæ¥ã®ããŒãã£ã·ã§ã³ãšåãããã«, ãã®è«çããªã¥ãŒã äžã«ãã¡ã€ã«ã·ã¹ãã ãäœã£ãŠå©çšå¯èœ. lvcreate ã³ãã³ãã䜿çšããŠäœæ.
äœæããè«çããªã¥ãŒã (LV) ãå®éã«äœ¿çšããã«ã¯ mkfs ã³ãã³ãã§, äœæããè«çããªã¥ãŒã ã«ãã¡ã€ã«ã·ã¹ãã ãäœæã, mount ã³ãã³ãã§ããŠã³ããã.
RAID ãšã®é¢ä¿
ArchWiki ã®ããŒãã«å³ããããããã.Software RAID and LVM - ArchWiki
- LVM + mirror ã¯ãã¹ãã® CPU ãå©çšãã.
- RAID ã¯ãã£ã¹ã¯ã¢ã¬ã€ã® CPU ãå©çšãã.
Network FileSystem
NFS
-
NFS on the Server sudo service nfs start. /etc/exports ã«å ±æãããã£ã¬ã¯ããªãæžã.
-
NFS on the Client /etc/fstab ã« NFS Server ã®å ±æãã£ã¬ã¯ããªãšããŠã³ããã€ã³ããæžã.
Proc FileSystem
/proc ã¯, ããã»ã¹ãã¡ã¢ãªãŒãªã©ã® Linux ã·ã¹ãã äžã®ãªãœãŒã¹é¢é£æ å ±ã, ãããããã¡ã€ã«ã§ãããã®ããã«é 眮ããä»®æ³çãªãã¡ã€ã«ã»ã·ã¹ãã .
ðRelated
<2024-07-27 Sat 08:00>
ãªããèªã¿è¿ããŠãããšãã£ããå¿ãã¡ãã£ããªãâŠ