Skip to content

Commit d502b8b

Browse files
committed
Small updates of general UNIX chapter.
1 parent 3015570 commit d502b8b

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

presentation/linux_bash_metacentrum_course.tex

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ \subsection{Disks and file systems}
540540
\begin{frame}{Short overview of hard disk layout}
541541
\begin{itemize}
542542
\item Physical disk (piece of hardware) has at least 1~partition --- division seen in Windows as \enquote{disks} (\texttt{C}, \texttt{D},~\ldots) and mounted directory in UNIX
543-
\item MBR --- older description of disk division, up to 4~primary partitions (OS typically requires at leas one to run), one can be extended and contain more partitions, disks up to 2~TB
543+
\item MBR --- older description of disk division, up to 4~primary partitions (OS typically requires at least one to run), one can be extended and contain more partitions, disks up to 2~TB
544544
\item GPT --- newer, no relevant limits, requires UEFI (replacement of BIOS --- responsible of start of nowadays computers)
545545
\item If unsure what to do, high probability to break it\ldots
546546
\item Blank new partition has to be formatted to desired file system according to use and target operating system
@@ -574,6 +574,25 @@ \subsection{Disks and file systems}
574574
\end{itemize}
575575
\end{frame}
576576

577+
\begin{frame}[fragile]{Mounting and unmounting disks and removable media}
578+
\begin{itemize}
579+
\item Mounting and unmounting of devices require root privileges
580+
\item In modern desktop Linux distributions, mounting is done automatically and media are visible mostly in \texttt{/media} or \texttt{/run/media} (and show some icon, widget or so in desktop environment)
581+
\item In Linux, physical disks are named from \texttt{sda} to \texttt{sdz}, each disk has partitions (at least one) numbered from \texttt{1}, (\texttt{sda1}, \texttt{sda2}, \texttt{sdb1},~\ldots), all are in \texttt{/dev} (\texttt{/dev/sdc3})
582+
\end{itemize}
583+
\begin{bashcode}
584+
eject # Open CD/DVD drive
585+
mount # Which FS (disk partitions) are mounted
586+
findmnt # See mounted devices in tree-like structure
587+
mkdir /mnt/point # Empty directory must exist prior mounting into it
588+
# mount usually recognize FS of mounted device, if not, add '-t FS_type'
589+
mount /dev/sdXY /mount/directory # Mount disk sdXY to /mount/directory
590+
mount -t iso9660 -o loop file.iso /mnt/iso # Mount CD/DVD ISO file
591+
umount /dev/sdXY # Unmount disk sdXY, alternatively use below command
592+
umount /mount/directory # Unmount disk from /mount/directory
593+
\end{bashcode}
594+
\end{frame}
595+
577596
\begin{frame}[allowframebreaks]{Creation and control of FS}
578597
\begin{center}
579598
\includegraphics[width=\textwidth]{disks.png}
@@ -627,25 +646,6 @@ \subsection{Disks and file systems}
627646
\end{itemize}
628647
\end{frame}
629648

630-
\begin{frame}[fragile]{Mounting and unmounting disks and removable media}
631-
\begin{itemize}
632-
\item Mounting and unmounting of devices require root privileges
633-
\item In modern desktop Linux distributions, mounting is done automatically and media are visible mostly in \texttt{/media} or \texttt{/run/media}
634-
\item In Linux, physical disks are named from \texttt{sda} to \texttt{sdz}, each disk has partitions (at least one) numbered from \texttt{1}, (\texttt{sda1}, \texttt{sda2}, \texttt{sdb1},~\ldots), all are in \texttt{/dev} (\texttt{/dev/sdc3})
635-
\end{itemize}
636-
\begin{bashcode}
637-
eject # Open CD/DVD drive
638-
mount # Which FS (disk partitions) are mounted
639-
findmnt # See mounted devices in tree-like structure
640-
mkdir /mnt/point # Empty directory must exist prior mounting into it
641-
# mount usually recognize FS of mounted device, if not, add '-t FS_type'
642-
mount /dev/sdXY /mount/directory # Mount disk sdXY to /mount/directory
643-
mount -t iso9660 -o loop file.iso /mnt/iso # Mount CD/DVD ISO file
644-
umount /dev/sdXY # Unmount disk sdXY, alternatively use below command
645-
umount /mount/directory # Unmount disk from /mount/directory
646-
\end{bashcode}
647-
\end{frame}
648-
649649
\begin{frame}{Put together more disks}{Extend space and get higher data security}
650650
\label{LVMRAID}
651651
\begin{itemize}
@@ -691,7 +691,7 @@ \subsection{Types of users}
691691
su -c "some command" # Launch one command with root permissions
692692
su USER # Became USER (USER's password is required)
693693
sudo -i # For trusted users, became root (asks for user's password)
694-
# User has to be listed in /etc/sudoers
694+
# User (or group) has to be listed in /etc/sudoers
695695
sudo somecommand # Launch somecommand with root's privileges - can be
696696
# restricted for particular commands; /etc/sudoers can
697697
# contain special settings for particular users/groups
@@ -704,7 +704,7 @@ \subsection{Directory structure}
704704
\begin{frame}[allowframebreaks]{Directory structure in Linux}
705705
\begin{itemize}
706706
\item It is similar also in another UN*X systems
707-
\item Directory structure in Linux is similar to macOS (but there it is bit hidden, users usually don't see everything), but very different from Windows logic
707+
\item Directory structure in Linux is similar to macOS (but there it is bit hidden, users usually don't see everything), but very different from Windows \enquote{logic}
708708
\item Top directory \enquote{\texttt{/}} --- \enquote{root}
709709
\item Everything else (including disks and network shares) are mounted in subdirectories (\texttt{/\ldots})
710710
\item \texttt{/bin} --- very basic command line utilities
@@ -729,7 +729,7 @@ \subsection{Directory structure}
729729
\item \alert{\texttt{/var}} --- data of most of applications and services, including e.g. database data, system logs,~\ldots
730730
\item \alert{\texttt{/windows}} --- if on dual boot, Windows disks are commonly mounted here
731731
\item In newest Linux distributions, most of \texttt{/bin}, \texttt{/etc}, \texttt{/lib}, \texttt{/lib64} and \texttt{/sbin} are mostly in \texttt{/usr} (original locations are just links)
732-
\item Can be altered, modified
732+
\item Can be altered, modified --- especially on various servers
733733
\item E.g. MetaCentrum has storage servers in various locations accessible from frontends and calculation nodes in \texttt{/storage}
734734
\item Usually, work only in your home, anywhere else modify files only if you are absolutely sure what you are doing
735735
\item Normal user doesn't have permission to modify files outside his directory (with exception of plugged removable media, etc.)
@@ -743,7 +743,7 @@ \subsection{Directory structure}
743743
\begin{itemize}
744744
\item Apache web server, database, FTP server, networking, basic system settings,~\ldots
745745
\end{itemize}
746-
\item \texttt{cron*} --- cron automatically repeatedly runs tasks
746+
\item \texttt{cron*} --- cron automatically repeatedly scheduled tasks
747747
\item \texttt{fstab} --- description of FS mounted during startup
748748
\item \texttt{group} --- list of users and groups
749749
\item \texttt{passwd} --- basic settings for users (home directory, default shell,~\ldots)
@@ -803,7 +803,7 @@ \subsection{Files and directories}
803803
\begin{frame}[fragile]{File names}
804804
\label{filenames}
805805
\begin{itemize}
806-
\item \alert{Space serves as separator of parameters}
806+
\item \alert{\textbf{Space} serves as separator of parameters}
807807
\item Linux allows \alert{any} character in file name, except \alert{slash} (\texttt{/}), so including anything on keyboard as well as line break (\alert{!}) --- be conservative\ldots
808808
\end{itemize}
809809
\begin{bashcode}
@@ -997,6 +997,9 @@ \subsection{Permissions}
997997
\item MetaCentrum has storages and clusters connected via NFSv4 protocol (see also slide~\ref{netfs}) --- commands \texttt{getfacl} and \texttt{setfacl} do not work there, use \texttt{nfs4\_getfacl}, \texttt{nfs4\_setfacl} and \texttt{nfs4\_editfacl} instead (usage is very similar), see also \url{https://wiki.metacentrum.cz/wiki/Access_Control_Lists_on_NFSv4}
998998
\item Permissions (\enquote{classical} as well as ACL) require some time to practice and master it\ldots
999999
\end{itemize}
1000+
\begin{block}{Importance of permissions}
1001+
\alert{Too permissive (wrong) permissions can lead to data loss, or to data inaccessibility!}
1002+
\end{block}
10001003
\end{frame}
10011004

10021005
\begin{frame}[fragile]{ACL examples}

0 commit comments

Comments
 (0)