You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: presentation/linux_bash_metacentrum_course.tex
+28-25Lines changed: 28 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -540,7 +540,7 @@ \subsection{Disks and file systems}
540
540
\begin{frame}{Short overview of hard disk layout}
541
541
\begin{itemize}
542
542
\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
544
544
\item GPT --- newer, no relevant limits, requires UEFI (replacement of BIOS --- responsible of start of nowadays computers)
545
545
\item If unsure what to do, high probability to break it\ldots
546
546
\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}
574
574
\end{itemize}
575
575
\end{frame}
576
576
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
+
577
596
\begin{frame}[allowframebreaks]{Creation and control of FS}
578
597
\begin{center}
579
598
\includegraphics[width=\textwidth]{disks.png}
@@ -627,25 +646,6 @@ \subsection{Disks and file systems}
627
646
\end{itemize}
628
647
\end{frame}
629
648
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
-
649
649
\begin{frame}{Put together more disks}{Extend space and get higher data security}
650
650
\label{LVMRAID}
651
651
\begin{itemize}
@@ -691,7 +691,7 @@ \subsection{Types of users}
691
691
su -c "some command" # Launch one command with root permissions
692
692
su USER # Became USER (USER's password is required)
693
693
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
695
695
sudo somecommand # Launch somecommand with root's privileges - can be
696
696
# restricted for particular commands; /etc/sudoers can
697
697
# contain special settings for particular users/groups
\begin{frame}[allowframebreaks]{Directory structure in Linux}
705
705
\begin{itemize}
706
706
\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}
708
708
\item Top directory \enquote{\texttt{/}} --- \enquote{root}
709
709
\item Everything else (including disks and network shares) are mounted in subdirectories (\texttt{/\ldots})
710
710
\item\texttt{/bin} --- very basic command line utilities
\item\alert{\texttt{/var}} --- data of most of applications and services, including e.g. database data, system logs,~\ldots
730
730
\item\alert{\texttt{/windows}} --- if on dual boot, Windows disks are commonly mounted here
731
731
\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
733
733
\item E.g. MetaCentrum has storage servers in various locations accessible from frontends and calculation nodes in \texttt{/storage}
734
734
\item Usually, work only in your home, anywhere else modify files only if you are absolutely sure what you are doing
735
735
\item Normal user doesn't have permission to modify files outside his directory (with exception of plugged removable media, etc.)
\item\texttt{fstab} --- description of FS mounted during startup
748
748
\item\texttt{group} --- list of users and groups
749
749
\item\texttt{passwd} --- basic settings for users (home directory, default shell,~\ldots)
@@ -803,7 +803,7 @@ \subsection{Files and directories}
803
803
\begin{frame}[fragile]{File names}
804
804
\label{filenames}
805
805
\begin{itemize}
806
-
\item\alert{Space serves as separator of parameters}
806
+
\item\alert{\textbf{Space} serves as separator of parameters}
807
807
\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
808
808
\end{itemize}
809
809
\begin{bashcode}
@@ -997,6 +997,9 @@ \subsection{Permissions}
997
997
\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}
998
998
\item Permissions (\enquote{classical} as well as ACL) require some time to practice and master it\ldots
999
999
\end{itemize}
1000
+
\begin{block}{Importance of permissions}
1001
+
\alert{Too permissive (wrong) permissions can lead to data loss, or to data inaccessibility!}
0 commit comments