[OS] Linux администрация homeworks_lecture_02

11. Find the major and minor number of /dev/mptctl and describe what this device is for. ==========================================================================================
In short:
/dev/mptctl @ (major,minor=10,220) - character special device
The “mptctl” kernel module is required to check the RAID status on a Linux server using “mpt-status” tool (the original mpt-status-1.0 tool written by Matt Braithwaite).
It allows one to monitor the health and status of RAID setup.
MegaRAID SAS is the current high-end RAID controllers series by LSI. It is fully hardware RAIDs controllers supporting RAID5, at least, with SAS or SATA interfaces.
mpt-status [ options ]
/dev/mptctl: character special device (major,minor=10,220)
----------------------------------------------------------------- Major and Minor Device Numbers
Devices are divided into sets called major device numbers. Eeach individual device has a minor device number. Major and minor device numbers identify the device to the kernel. The file name of the device is arbitrary and is chosen for convenience and consistency. As of Version 2.6.0 of the kernel, a 32-bit quantity with 12 bits set aside for the major number and 20-bit quantity - for the minor number. The 2.6 kernel can accommodate a vast number of devices, while previous kernel versions were limited to 255 major and 255 minor numbers.
From "ls -l /dev/":
crw--w---- 1 root tty 4, 12 Jul 1 19:27 tty12
"c" - char device; major: 4; minor: 12;
The our case:
10 <--> major number; char device; misc
220 <--> /dev/mptctl Message passing technology (MPT) control
The major number 10 - identifies the device driver of char device and the minor number 220 - identifies a particular device (possibly out of many) that the driver controls.
Character special files or character devices: - through which the system transmits data one character at a time; - often are for stream communication; - usually do not support random access to data; - in most implementations, character devices use unbuffered input and output routines.
Although all devices are listed in the /dev directory, you can create a device anywhere in the file system by using the mknod command:
mknod [-m


3. What is the command and its parameters to mount a windows fs in such a way that all files and dirs in it will be owned by user "naso" and group "students".
mount  -t cifs -o username=alabastur,password=Kotka2013,uid=naso,gid=students // /home/komadrin/test/
-t type device dir 
This tells the kernel to attach the filesystem found on device (which is of type type) at the directory dir. The 
previous contents (if any) and owner and mode of dir become invisible, and as long as this filesystem remains mounted,
 the pathname dir refers to the root of the filesystem on device.
 mount  -t cifs
 This command only works in Linux, and the kernel must support the cifs filesystem. The CIFS protocol is the successor to the 
 SMB protocol and is supported by most Windows servers and many other commercial servers and Network Attached Storage appliances as
 well as by the popular Open Source server Samba.
specifies the username to connect as. If this is not given, then the environment variable USER is used. This option can
also take the form "user%password" or "workgroup/user" or "workgroup/user%password" to allow the password and workgroup
to be specified as part of the username. 
specifies the CIFS password. If this option is not given then the environment variable PASSWD is used. If the password 
is not specified directly or indirectly via an argument to mount, mount.cifs will prompt for a password, unless the guest option is specified. 
Note that a password which contains the delimiter character (i.e. a comma ',') will fail to be parsed correctly on the command line. However, 
the same password defined in the PASSWD environment variable or via a credentials file (see below) or entered at the password prompt will be 
read correctly.
sets the uid that will own all files or directories on the mounted filesystem when the server does not provide ownership information.
It may be specified as either a username or a numeric uid. When not specified, the default is uid 0. 
sets the gid that will own all files or directories on the mounted filesystem when the server does not provide ownership information. 
It may be specified as either a groupname or a numeric gid. When not specified, the default is gid 0. 


4. Write down at least 3 Linux file systems optimized especially for Flash drives(SD cards, USB Drives, SSD disks).
I. ext4 - Файлова система, която благодарение на цялостната си оптимитация дава и много добри резултати в четенето/писането и времето за достъп и при флаш устройстват.
II. F2FS - специално създадена файлова система за флаш устройства от Kim Jaegeuk . Като типът на файловата система е log-structured, като за съжаление не са фиксирани някои от познатите бъгове - snowball effect.
III. VFAT - "Virtual FAT", файлова система, която е на почти всяко флаш устройство поради факта, че работи коректно с всяка операционна система.
Тестове с различни файлове системи с Class 10 SD карта:
Ext2 Ext3 Ext4 Reiser3 VFat NTFS Write 368 501 125 582 518 174 Read 53 60 53 72 98 118
Тестове с евтина 2GB no-name флашка:
Ext2 Ext3 Ext4 Reiser3 VFat NTFS Write 434 361 156 750 564 165 Read 50 64 48 87 51 125
Горните тестове са с доста на брой малки файлове, а следващия с един голям на SD карта:
Ext2 Ext3 Ext4 Reiser3 VFat NTFS Write 14.45 11.21 8.67 18.31 8.36 16.08 Read 4.72 4.55 4.66 4.74 4.44 4.48
Всички файлови системи, без значение от ОС, които са оптимизирани с флаш устройства:
CASL is a filesystem designed by Nimble Storage that uses solid-state devices to cache traditional hard disk drives. ETFS - Embedded Transactional File System. Designed primarily for NAND devices by QNX Software Systems. exFAT - Microsoft proprietary system intended for flash cards ExtremeFFS - Internal file system for SSDs. F2FS – Flash-Friendly File System. An open source Linux file system introduced by Samsung in 2012. FFS2 (presumably preceded by FFS1), one of the earliest flash file systems. Developed and patented by Microsoft in the early 1990s. JFFS – Original log structured Linux file system for NOR flash media JFFS2 – Successor of JFFS, for NAND and NOR flash LogFS – Intended to replace JFFS2, better scalability. In early development. Non-Volatile File System—the "non-volatile file system" for flash memory introduced by Palm, Inc.. OneFS - OneFS is a file system utilized by Isilon. It supports selective placement of meta-data directly onto flash SSD. RFS - Robust File System (developed and used by Samsung) Segger Microcontroller Systems emFile - File system for deeply embedded applications which supports both NAND and NOR flashes. Wear leveling, fast read and write, and very low RAM usage. TFAT – A transactional version of the FAT filesystem. TrueFFS - Internal file system for SSDs, implementing error correction, bad block re-mapping and wear levelling. UBIFS – Successor of JFFS2 optimized to utilize non-volatile DRAM UFFS - Ultra low cost flash file system for embedded system Unison RTOS - Fsys-Nand/Nor small footprint low cost flash file system for embedded systems Write Anywhere File Layout - WAFL is an internal file system utilized by NetApp within their DataONTAP OS, originally optimized to use non-volatile DRAM XCFiles – an exFAT implementation from Datalight for Wind River VxWorks and other embedded operating systems YAFFS – A Log structured file system designed for NAND flash, but also used with NOR flash. ZFS - Allows placing write-ahead log (ZIL) on flash, and using flash as a second-level read cache (L2ARC)
Източници: http://en.wikipedia.org/wiki/List_of_flash_file_systems http://www.linuxplanet.com/linuxplanet/tutorials/7208/1

от ivanmar (307 точки)

10. Configure GRUB to load a kernel and its initrd from the Network.
Здравейте, Поработих по тази "знакова" :) задача от домашните, но тъй като не успях да подкарам практически нещата докрай, предадох друга. Би ми било интересно ако някой я е осъществил да сподели решението. Ето докъде достигнах аз:
I. По теоретичната част на задачата няма проблем. Частта по настройката на GRUB e оттук http://tr.opensuse.org/SDB:Booting_from_the_Network_with_GRUB 1. Компилира се Grub с активиране на използваната мрежова карта. 2.Инсталира се 3. reboot и от промпта на grub: grub>dhcp - -да получим ip адрес grub > root (nd) - казваме че ще зареждаме файловете от нетуорк драйв grub > kernel /linux install= - да заредим ядрото grub > initrd /initrd - и рам-диска grub > boot - boot-ваме
II. Практическа част: Постановката е един CentOS на VirtualBox за DHCP и TFTP сървър и един CentOS пак на VB за клиент, където да настроиме GRUB.
Обаче: VirtuaBox емулира следните карти: AMD PCNet PCI II (Am79C970A); AMD PCNet FAST III (Am79C973, the default); Intel PRO/1000 MT Desktop (82540EM); Intel PRO/1000 T Server (82543GC); Intel PRO/1000 MT Server (82545EM); Paravirtualized network adapter (virtio-net).
А Gurb 0.97 поддържа следните мрежови карти: --enable-3c509 enable 3Com509 driver --enable-3c529 enable 3Com529 driver --enable-3c595 enable 3Com595 driver --enable-3c90x enable 3Com90x driver --enable-cs89x0 enable CS89x0 driver --enable-davicom enable Davicom driver --enable-depca enable DEPCA and EtherWORKS driver --enable-eepro enable Etherexpress Pro/10 driver --enable-eepro100 enable Etherexpress Pro/100 driver --enable-epic100 enable SMC 83c170 EPIC/100 driver --enable-3c507 enable 3Com507 driver --enable-exos205 enable EXOS205 driver --enable-ni5210 enable Racal-Interlan NI5210 driver --enable-lance enable Lance PCI PCNet/32 driver --enable-ne2100 enable Novell NE2100 driver --enable-ni6510 enable Racal-Interlan NI6510 driver --enable-natsemi enable NatSemi DP8381x driver --enable-ni5010 enable Racal-Interlan NI5010 driver --enable-3c503 enable 3Com503 driver --enable-ne enable NE1000/2000 ISA driver --enable-ns8390 enable NE2000 PCI driver --enable-wd enable WD8003/8013, SMC8216/8416 driver --enable-otulip enable old Tulip driver --enable-rtl8139 enable Realtek 8139 driver --enable-sis900 enable SIS 900 and SIS 7016 driver --enable-sk-g16 enable Schneider and Koch G16 driver --enable-smc9000 enable SMC9000 driver --enable-tiara enable Tiara driver --enable-tulip enable Tulip driver --enable-via-rhine enable Rhine-I/II driver --enable-w89c840 enable Winbond W89c840, Compex RL100-ATX driver --enable-3c503-shmem use 3c503 shared memory mode --enable-3c503-aui use AUI by default on 3c503 cards
Не виждам да има застъпване. Ако някой вижда съответствие моля да сподели. Т.е VBox не ни върши работа в случая.
Въпреки това ще опитам да компилирам Grub 0.97 на горната машина с някоя от поддържаните карти. Даунлоадвам сорса и го ънтарвам в някаква директория. Компилирам.(преди това инсталирам make, gcc, binutils) При компилирането с ./configure възникна следната грешка: configure: error: GRUB requires a working absolute objcopy; upgrade your binutils
А binutils са достатъчно висока версия: >yum info binutils Installed Packages Name : binutils Arch : i686 Version : Release : 5.34.el6 Size : 8.8 M Repo : installed
>gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-3)
Изтрих от configure файла проверката: 3907 # if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest' 3908 # { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 3909 # (eval $ac_try) 2>&5 3910 # ac_status=$? 3911 # echo "$as_me:$LINENO: \$? = $ac_status" >&5 3912 # (exit $ac_status); }; }; then : 3913 # else 3914 # { { echo "$as_me:$LINENO: error: ${OBJCOPY-objcopy} cannot create binary files" >&5 3915 # echo "$as_me: error: ${OBJCOPY-objcopy} cannot create binary files" >&2;} 3916 # { (exit 1); exit 1; }; } 3917 # fi
Сега компилирането минава успешно.
Заключение: На физическа машина с поддържан от grub NIC, процеса би минал по горното описание и задачата би била решена.

от RosenN (80 точки)

1. Find the major and minor numbers for the "watchdog" devices.
major 10 , minor 130  
( www.linuxjournal.com/article/217 ) 

5. Describe what is stored in /var/run & /var/lock and how the two dirs are actually used on most Linux distros.
#Contains the process identification files (PIDs) of system services and other information about the system that is valid until the system is next booted. For example, /var/run/utmp contains information about users currently logged in. The command to list the users currently logged in is:
> last -f /var/run/utmp
#Many programs follow a convention to create a lock file in /var/lock to indicate that they are using a particular device or file. This directory holds those lock files (for some devices) and hopefully other programs will notice the lock file and won't attempt to use the device or file. 
Lock files should be stored within the /var/lock directory structure. Lock files for devices and other resources shared by multiple applications, such as the serial device lock files that were originally found in either /usr/spool/locks or /usr/spool/uucp, must now be stored in /var/lock. The naming convention which must be used is LCK.. followed by the base name of the device file. For example, to lock /dev/ttyS0 the file LCK..ttyS0 would be created. The format used for the contents of such lock files must be the HDB UUCP lock file format. The HDB format is to store the process identifier (PID) as a ten byte ASCII decimal number, with a trailing newline. For example, if process 1230 holds a lock file, it would contain the eleven characters: space, space, space, space, space, space, one, two, three, zero, and newline.
#Източник: http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/var.html

от kostadinov7 (10 точки)