Skip to content
Snippets Groups Projects
Commit 91243764 authored by Bertrand  NÉRON's avatar Bertrand NÉRON
Browse files

add content about disk usage and space left

parent 6c7be908
No related branches found
No related tags found
No related merge requests found
.. Linux administration for Pasteur Network Course: Bioinformatics for SARS-CoV-2 sequence analysis .. Linux administration for Pasteur Network Course: Bioinformatics for SARS-CoV-2 sequence analysis
.. role:: red
.. _linux_admin: .. _linux_admin:
==================== ====================
...@@ -115,10 +117,25 @@ to be granted and execute a command with the root privilege, you need to precede ...@@ -115,10 +117,25 @@ to be granted and execute a command with the root privilege, you need to precede
The first time you execute a command as sudo you will ask to confirm your password. The first time you execute a command as sudo you will ask to confirm your password.
Your password is available for one shell, so if you execute a second command in an other terminal you will ask again for your password. Your password is available for one shell, so if you execute a second command in an other terminal you will ask again for your password.
.. code-block:: .. code-block:: shell
sudo useradd ... sudo useradd ...
allow one user to be sudoers just add it in group ``sudo``
.. code-block:: shell
sudo usermod -a -G sudo <username>
This command a <username> in the secondary group ``sudo``
To fine tune the sudoers permission you have to edit the sudoers configuration file
withe the command
.. code-block:: shell
sudo visudo
create new user create new user
=============== ===============
...@@ -147,16 +164,166 @@ check you identity ...@@ -147,16 +164,166 @@ check you identity
whoami whoami
------ ------
To know your login
id id
-- --
to know your
* login/uid
* primary group/gid
* all secondaries groups user belong to
.. code-block:: shell
$ id
uid=1000(cronos) gid=10010(cronos) groups=1001(cronos),4(adm),24(cdrom),27(sudo),48(docker),100(users), ...
$ id cronos
uid=1000(cronos) gid=10010(cronos) groups=1001(cronos),4(adm),24(cdrom),27(sudo),48(docker),100(users), ...
access to external hard drive access to external hard drive
============================= =============================
All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /.
These files can be spread out over several devices.
.. note::
install package A quick note on the filesystem: it’s a hierarchy of directories that systems use to organize file(s) and folder(s) on a storage media.
=============== Filesystem exists in every single storage solution:
USB flash drive, CD-ROM, HDD, SSD, and even floppy disks! In the case of UNIX/Linux and similar systems,
the filesystem starts with the root directory (noted as “/”).
Under “root”, all the other child filesystems exist.
The mount command serves to attach the file system found on some device to the big file tree.
basics
When you insert usbkey in your computer, xubuntu detect it and trigger a mount command
Unfortunately it does not do the same for filesystem on network.
it will be case to connect the PC to the mk1c sequencer.
So we will have to mount manually the filesystem of the sequencer on our machine to use allow ``rampart`` to access
to the data in realtime.
We saw that mount include a device on the our local file system
So we need to know
- which device
- a location where to mount the device we called mounting point
The mounting point is just a regular directory.
- there are several filesystem formats ext4,vfat, .... so we need to specify which protocol
- only root can mount a new device
sudo mount -t <format> <device> <mounting point> <option>
In our case the mk1c export its filesystem over network with the cifs protocol
To do only Once
sudo mkdir -p /mnt/mk1c
To do each time you need to connect the Pc to the mk1c
sudo mount -t cifs //mk1c ip address/data -ousername=<the user on mk1c>,uid=<your uid on the Pc>,gid=<your primary gid on the Pc> /mnt/mk1c
$ sudo mount -t cifs //192.168.0.10/data -ousername=minit,uid=1000,gid=1000 /mnt/mk1c
passowrd ******
ls -l /mnt/mk1c
Conversely, the umount command will detach it again.
to deconnect the Pc from the mk1c
sudo umount /mnt/mk1c
The storage system is not infinite
==================================
Any hard drive have a size.
Sequencing generate data.
You have to monitor the size used and free on the mk1c, otherwise you risk to have an error
``No space left on device`` and you :red:`will lost the run`.
df
--
The `df` command stands for “disk filesystem“,
it is used to get a full summary of available and used disk space usage of the file system on the Linux system.
`df` without option or argument display space usage for all mounted devices
.. code-block::
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1559800 2016 1557784 1% /run
/dev/nvme0n1p5 284239328 20531532 249196232 8% /
tmpfs 7798984 0 7798984 0% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
/dev/nvme0n1p1 262144 33432 228712 13% /boot/efi
tmpfs 1559796 92 1559704 1% /run/user/1000
The `-h` *stand for humam readable* dispaly the same information but the size is converted in Ko/Mo/Go
.. code-block::
$ df -h
Filesystem Size Used Avail Use% Mounted on
tmpfs 1.5G 2.1M 1.5G 1% /run
/dev/nvme0n1p5 272G 20G 238G 8% /
tmpfs 7.5G 0 7.5G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
/dev/nvme0n1p1 256M 33M 224M 13% /boot/efi
tmpfs 1.5G 92K 1.5G 1% /run/user/1000
You ca restraint the display to one device here / is for the root filesystem
.. code-block::
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p5 272G 20G 238G 8% /
du
--
Conversely `du` show you the space used by some files / directories
one very useful command with du is with options
* -h for human readable
* -s summary instead to show you the size of all files and recursively files in directories,
it display only the size of the level ask and display the size used by the directory (not each files inside directories
.. code-block::
$ cd
$ du -sh *
30M artic-ncov2019
30M Desktop
4.0K Documents
508K Downloads
5.3G miniconda3
59M Miniconda3-py39_4.9.2-Linux-x86_64.sh
4.0K Music
4.0K Pictures
4.0K Public
350M snap
20K Templates
4.0K Videos
Installing package
==================
Linux distinguish from other operating system by packaging lot of software. Linux distinguish from other operating system by packaging lot of software.
and a package management system. and a package management system.
...@@ -237,5 +404,5 @@ You will warn of new release by the package manager after a "classical" update o ...@@ -237,5 +404,5 @@ You will warn of new release by the package manager after a "classical" update o
.. code-block:: .. code-block::
sudo apt-get distupgrade sudo apt dist-upgrade
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment