Jump to content

Search the Community

Showing results for tags 'mounts'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • General Discussion
    • Artificial Intelligence
    • DevOpsForum News
  • DevOps & SRE
    • DevOps & SRE General Discussion
    • Databases, Data Engineering & Data Science
    • Development & Programming
    • CI/CD, GitOps, Orchestration & Scheduling
    • Docker, Containers, Microservices, Serverless & Virtualization
    • Infrastructure-as-Code
    • Kubernetes & Container Orchestration
    • Linux
    • Logging, Monitoring & Observability
    • Security, Governance, Risk & Compliance
  • Cloud Providers
    • Amazon Web Services
    • Google Cloud Platform
    • Microsoft Azure

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


LinkedIn Profile URL


About Me


Cloud Platforms


Cloud Experience


Development Experience


Current Role


Skills


Certifications


Favourite Tools


Interests

Found 8 results

  1. In this article, I am going to show you how to mount a USB thumb drive or a USB HDD/SSD on your Proxmox VE server. Table of Contents: Finding the USB Thumb Drive/HDD/SSD to Mount on Proxmox VE Creating a Mount Point for the USB Storage Device on Proxmox VE Mounting the USB Storage Device on Proxmox VE Confirming the USB Storage Device is Mounted on Proxmox VE Conclusion Finding the USB Thumb Drive/HDD/SSD to Mount on Proxmox VE: First, insert the USB thumb drive or USB HDD/SSD on your Proxmox VE server and run the command below to find the device path of the USB storage device. $ lsblk -p In this case, my 32GB USB thumb drive has the device path /dev/sdd and it has a partition /dev/sdd1. You will be mounting the partition of your USB storage device on your Proxmox VE server. To learn more about the partition /dev/sdd1 (let’s say) of the USB storage device on your Proxmox VE server, run the blkid command as follows: $ blkid /dev/sdd1 As you can see, the partition /dev/sdd1 has the filesystem label backup[1] and is formatted as the NTFS filesystem[2]. Creating a Mount Point for the USB Storage Device on Proxmox VE: You can create a mount point /mnt/usb/backup (let’s say) for the USB storage device with the mkdir command as follows: $ mkdir -pv /mnt/usb/backup Mounting the USB Storage Device on Proxmox VE: To mount the partition /dev/sdd1 (let’s say) of the USB storage device on the mount point /mnt/usb/backup (let’s say), run the following command: $ mount /dev/sdd1 /mnt/usb/backup Confirming the USB Storage Device is Mounted on Proxmox VE: To confirm whether the partition /dev/sdd1 (let’s say) of the USB storage device is mounted, run the following command: $ df -h /dev/sdd1 As you can see, the partition /dev/sdd1 is mounted[1] in the path /mnt/usb/backup[2]. The usage information of the partition is also displayed[3]. Once the partition is mounted, you can access the files stored on the USB storage device from the Proxmox VE shell. $ ls -lh /mnt/usb/backup Conclusion: In this article, I have shown you how to find the device path of a USB thumb drive or USB HDD/SSD on Proxmox VE. I have also shown you how to create a mount point, mount the USB storage device on the mount point, and access the files stored on the USB storage device from the Proxmox VE shell. View the full article
  2. File management in Linux has always been the most essential part of a user’s workflow. Fortunately, it has a great file system and offers various features for efficient file management. It has commands for creating or deleting the directories, listing them, displaying their content, limiting the access, and many more. It lets you view the mounted drives and is handy for system monitoring, storage management, troubleshooting disk issues, remote system management, etc. However, learning how to show the mounts is essential for every Linux user. So, in this quick blog, we will explain the different commands to show the mounts in Linux. How to Show the Mounts in Linux To display the mounted drives, you merely need to enter a few commands. Here, we included multiple commands to show the mounts easily. 1. The Mount Command The “mount” command displays a comprehensive list of the mounts including their mount point, file system type, and mount options. mount 2. The Df Command If you want to have a detailed insight into the mounted file systems and disk space that are used by them, use the “df” command. df -h The “-h” option instructs the system to display it in a human-readable format. 3. Read /etc/fstab File You can view the disk drives and their partitioning information by reading the “/etc/fstab” file. Cat /etc/fstab This command, upon execution, presents everything on the command line itself. 4. The Findmnt Command The “findmnt” command is an advanced version of the mount command as it provides a more detailed output. Further, it also shows the mounts in a tree-like structure with their file type and mount options. Conclusion Linux has a sturdy file management system, and listing the mounts is fundamental for most users. You can accomplish it using different commands according to the use cases. Thus, this blog includes four methods of showing the mounts in Linux: the mount, df, and findmnt commands, and the “/etc/fstab” file. View the full article
  3. While working on a development project in Docker, developers usually want to make modifications in the code and see the changes reflected immediately without rebuilding the container. In this situation, use a bind mount to mount the code directory on their local host machine into the container. Upon doing so, the modifications made on the host are immediately reflected inside the container. Moreover, it is useful when the container is deleted or rejected as the data is not lost. This article will illustrate: What is Docker Bind Mounts? How Bind Mount Work in Docker? What is Docker Bind Mounts? A Docker bind mount permits users to map a particular file/directory on the host machine to a file/directory within a container. This way, users can share data between the host and the container, and also persist the data even after the container is stopped or deleted. Any changes made to files in the shared directory or file are visible from both the container and the host machine. How Bind Mount Work in Docker? Let us take an example and see how bind-mount works in Docker. Suppose that we have an empty directory “Test” located at “C:\Docker” on a local system. Now, we want to access the “Test” directory’s content at the location “/app” from within a particular container. In this example, run a container from the official Docker image i.e., “nginx” and utilize the bind mount to mount a specific directory from the host machine into the container. For a better understanding, follow the provided steps. Step 1: Bind Mount Directory From Host Machine to Container First, utilize the “docker run -d –name <container-name> -v <source-path>:<destination-path> <image-name>” command and run a container. It binds the mount directory from the host machine to the container: docker run -d --name myCont -v C:/Docker/Test:/app nginx:latest Here: “-d” option is used to execute the container in the background. “–name” is used to define the container name. “myCont” is our container name. “-v” option creates a volume in the container that maps the source directory on the host machine to the target directory in the container. “C:/Docker/Test” is the path of the source directory (local machine). “/app” is the target directory (container) path. “nginx:latest” is the latest Docker image: This command has created a container and allowed it to access files from the host machine and making it easier to manage data persistence. Step 2: Create a File in Source Directory on Host Machine Then, navigate to the source directory path i.e., “C:/Docker/Test” on the host machine and create a plain text file in it. For instance, we have created a “Demo” file: Step 3: Access the Host Machine File Inside the Container Now, type out the below-provided command to access the container’s content and run commands inside it: docker exec -it myCont bash Upon doing so, the container shell will open. After that, list the container’s content using the provided command: ls In the above screenshot, all the content of the container can be seen. Choose the desired directory and navigate to it. Redirect to the “app” directory: cd app Then, list the “app” directory content to verify the local machine file is available in it: ls It can be observed that the “Demo.txt” file is available inside the container, and we can access it. Step 4: Create File Inside Container Next, create another file inside a container using the “touch” command: touch new.txt We have created a “new.txt” file. Then, verify the newly created file using the below-listed command: ls It can be seen that the file “new.txt” has been created successfully inside the container. Step 5: Verify File on the Local System Finally, navigate to the local machine path and check if the “new.txt” file is available or not: As you can see, the “new.txt” file is available on the local machine, and we can access it. This indicates that the modifications are reflected on the local machine also. Step 6: Remove Docker Container Now, remove the container via the “docker rm” command along with the container name: docker rm myCont The “myCont” container has been deleted successfully. Step 7: Ensure Data Persisted on the Local Machine After deleting the container, verify whether the data persisted on the local machine on not: As you can see, the changes persisted even after deleting the bind-mount container. Conclusion Docker bind mount is used to map a directory or file from the host system into the container. It creates a link between the specified directory or file on the host and the container’s filesystem. It makes it easy and simple to deal or work with files that are stored outside the container. Any changes made to files in the shared directory or file will be reflected in both the host and container. This article has explained about Docker bind mount and its working in Docker. View the full article
  4. The OS(operating system) employs the file system which is known as the file system in a computer language that is commonly abbreviated to “fs”. The “fs” is a technique that regulates how well the piece of information is protected and accessed. Without a file system, the content of the file in a memory device would not distinguish between one type of information. The information can be easily extracted and recognized by making the groups and assigning each group a name. Each group of information is referred to as a “file,” which is a terminology derived from a paper-based data management system. A “file system” is the term referring to both the organizational framework and logical principles that are used to handle the names and groupings of information. Different Techniques of Checking the Filesystem Mounted Type in Linux There are many different file system varieties in Linux that will provide several terminal commands and techniques to check the filesystem mounted type in Linux. Let us just start delving and fully understanding how well the filesystem functions in terms of understanding the various filesystem varieties in Linux and how we are going to execute each method one at a time. Prerequisite: Installing util-linux To use the root privileges of accessing the different types of file systems in Linux, we will first write the “sudo” keyword in the Linux terminal. Then, we will write the “apt” which will upgrade the deb packages. To access the mounted files system in the Linux, we use different steps to install the “util-linux” as seen below: linux@linux-VirtualBox:~ sudo apt install util-linux After writing the “sudo” command, we first have to enter the password of the Linux then it will show further details. [sudo] password for linux: Reading package lists... Done Building dependency tree Reading state information... Done util-linux is already the newest version (2.34-0.1ubuntu9.3). 0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded. After installing the “util-linux”, now we can easily apply the different techniques to check the filesystem mounted type. Technique 01: The “fsck” Command The Linux command fsck stands for File System Consistency Check which analyzes filesystems for faults or unresolved problems. Step: 01 The instruction employed to produce statistics and correct potential problems is written below: linux@linux-VirtualBox:~$ sudo fsck -N fsck from util-linux 2.34 [/usr/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/sda5 [/usr/sbin/fsck.vfat (1) -- /boot/efi] fsck.vfat /dev/sda1 To get the certain filesystem, we will write the path of the filesystem which we want to get: linux@linux-VirtualBox:~$ sudo fsck –N /dev/sda5 fsck from util-linux 2.34 [/usr/sbin/fsck.ext4 (1) -- /] fsck.ext4 /dev/sda5 Step: 02 To get additional information on the “fsck” statement, use the “man fsck” statement. Following is the full command: linux@linux-VirtualBox:~$ man fsck Technique 02: The “mount” Command The “mount” statement will provide all the mounted devices along with the filesystem format and mounted location in Linux. Step 01: To get the mounted filesystem’s type, we will write first the “mount” keyword along with “grep” so that we can only get those mounted files that we want to display. This is why we have provided the “^/dev” path. linux@linux-VirtualBox:~$ mount | grep “^/dev” /dev/sda5 on / type ext4 (rw,relatime,errors remount-ro) /dev/sda1 on /boot/efi type vfat (rw, relatime, fmask=0077, dmask=0077,codepage=43 7,iocharset=iso8859-1, shortname-mixed, errors=remount-ro) Step: 02 To understand more clearly about the “mount” command, write the below INSTRUCTION: linux@linux-VirtualBox:~$ man mount Technique 03: The “findmnt” Command Now, we are going to implement another technique to check the filesystem type which is “findmnt” statements in Linux. In the findmnt statement, it will show all the mounted filesystems in the device. Step: 01 The “findmnt” statement returns the target, source, and fstype which means file system type and the options which contain whether the file is read/write or read-only. At the top of the tree of the filesystem, it will be the root directory and here it is “ext4”. linux@linux-VirtualBox:~$ findmnt TARGET SOURCE FSTYPE OPTIONS / /dev/sda5 ext4 rw,relatime,errors=rem ├─/sys sysfs sysfs rw,nosuid,nodev,noexec │ ├─/sys/kernel/security securityfs securi rw,nosuid,nodev,noexec │ ├─/sys/fs/cgroup tmpfs tmpfs ro,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/unified cgroup2 cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/systemd cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/rdma cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/cpu,cpuacct cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/cpuset cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/net_cls,net_prio cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/blkio cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/misc cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/perf_event cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/devices cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/pids cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/memory cgroup cgroup rw,nosuid,nodev,noexec │ │ ├─/sys/fs/cgroup/hugetlb cgroup cgroup rw,nosuid,nodev,noexec │ │ └─/sys/fs/cgroup/freezer cgroup cgroup rw,nosuid,nodev,noexec │ ├─/sys/fs/pstore pstore pstore rw,nosuid,nodev,noexec │ ├─/sys/fs/bpf bpf bpf rw,nosuid,nodev,noexec │ ├─/sys/kernel/debug debugfs debugf rw,nosuid,nodev,noexec │ ├─/sys/kernel/tracing tracefs tracef rw,nosuid,nodev,noexec │ ├─/sys/fs/fuse/connections fusectl fusect rw,nosuid,nodev,noexec │ └─/sys/kernel/config configfs config rw,nosuid,nodev,noexec ├─/proc proc proc rw,nosuid,nodev,noexec │ └─/proc/sys/fs/binfmt_misc systemd-1 autofs rw,relatime,fd=28,pgrp │ └─/proc/sys/fs/binfmt_misc binfmt_misc binfmt rw,nosuid,nodev,noexec ├─/dev udev devtmp rw,nosuid,noexec,relat │ ├─/dev/pts devpts devpts rw,nosuid,noexec,relat │ ├─/dev/shm tmpfs tmpfs rw,nosuid,nodev,inode6 │ ├─/dev/mqueue mqueue mqueue rw,nosuid,nodev,noexec │ └─/dev/hugepages hugetlbfs hugetl rw,relatime,pagesize=2 ├─/run tmpfs tmpfs rw,nosuid,nodev,noexec │ ├─/run/lock tmpfs tmpfs rw,nosuid,nodev,noexec │ └─/run/user/1000 tmpfs tmpfs rw,nosuid,nodev,relati │ └─/run/user/1000/gvfs gvfsd-fuse fuse.g rw,nosuid,nodev,relati ├─/snap/bare/5 /dev/loop0 squash ro,nodev,relatime,erro ├─/snap/glances/1243 /dev/loop1 squash ro,nodev,relatime,erro ├─/snap/core20/1778 /dev/loop2 squash ro,nodev,relatime,erro ├─/snap/core20/1738 /dev/loop3 squash ro,nodev,relatime,erro ├─/snap/glances/1168 /dev/loop4 squash ro,nodev,relatime,erro ├─/snap/gnome-3-38-2004/115 /dev/loop5 squash ro,nodev,relatime,erro ├─/snap/gnome-3-38-2004/119 /dev/loop6 squash ro,nodev,relatime,erro ├─/snap/gtk-common-themes/1535 /dev/loop7 squash ro,nodev,relatime,erro ├─/snap/snap-store/558 /dev/loop8 squash ro,nodev,relatime,erro ├─/snap/snap-store/638 /dev/loop9 squash ro,nodev,relatime,erro ├─/snap/snapd/17883 /dev/loop10 squash ro,nodev,relatime,erro └─/boot/efi /dev/sda1 vfat rw,relatime,fmask=0077 Step: 02 If you want to dig deeper into the understanding of the “findmnt” command: linux@linux-VirtualBox:~$ man findmnt Here is the detailed information about the “findmnt” command which was open on another Linux man terminal page. If you want to go back to the man terminal page, you have to press “q” to exit the “man findmnt” terminal. Technique 04: The “file” Command The “file” statement, which is employed to verify the kind of a certain file, is a further technique we will employ in the filesystems in Linux. Step: 01 Below is a different example where we are checking the different filesystems while giving the different filesystems paths. linux@linux-VirtualBox:~$ sudo file –sL /dev/sda1 /dev/sda1: DOS/MBR boot sector, code offset 0x58+2, OEM-ID "mkfs.fat", sectors/ cluster 8, Media descriptor 0xf8, sectors/track 63, heads 255, hidden sectors 2048, sectors 1048576 (volumes > 32 MB), FAT (32 bit), sectors/FAT 1024, reserve d 0x1, serial number 0x58c97606, unlabeled linux@linux-VirtualBox:~$ sudo file –sL /dev/sda5 /dev/sda5: Linux rev 1.0 ext4 filesysten data, UUID=6e3d13f8-16f7-4e12-bff8-8ca 1bbb6d0bd (needs journal recovery) (extents) (64bit) (large files) (huge files) Step: 02 Write the following command on the terminal and hit enter if you want further information: linux@linux-VirtualBox:~$ man file Technique 05: The “blkid” Command The “blkid” statement is another technique of the filesystem in Linux which is used to find and print the block device’s information. Step: 01 To access the information of blocked devices, we will simply write the blkid command in the terminal. linux@linux-VirtualBox:~$ sudo blkid As shown in the terminal, we have gotten the information along with the type of the filesystem. /dev/sda5: UUID="6e3d13f8-16f7-4e12-bff8-8ca1bbb6d0bd" TYPE="ext4" PARTUUID="e8ce01c9-05" /dev/loop0: TYPE="squashfs" /dev/loop1: TYPE="squashfs" /dev/loop2: TYPE="squashfs" /dev/loop3: TYPE="squashfs" /dev/loop4: TYPE="squashfs" /dev/loop5: TYPE="squashfs" /dev/loop6: TYPE="squashfs" /dev/loop7: TYPE="squashfs" /dev/sda1: UUID="58C9-7606" TYPE="vfat" PARTUUID="e8ce01c9-01" /dev/loop8: TYPE="squashfs" /dev/loop9: TYPE="squashfs" /dev/loop10: TYPE="squashfs" In the “blkid” command, if we want to display the information of the specific device, then we will write the path of the device which we want to get after writing the “sudo blkid” in the terminal. linux@linux-VirtualBox:~$ sudo blkid /dev/sda1 /dev/sda1: UUID="58C9-7606" TYPE="vfat" PARTUUID="e8ce01c9-01" Step: 02 We can access the “man” page of the “blkid” phrase in Linux and view additional details about it by typing the command below. linux@linux-VirtualBox:~$ man blkid Technique 06: The “df” Command Here is another technique to figure out the overall disc space and free space on a Linux filesystem, by utilizing the “df” command in the terminal. Step: 01 Let us just learn how to examine the quantity of free space still available in the Linux filesystem using the “df” statement. As you see below, we have got the filesystem which is the name of the mounted filesystem and it will also display the type. The “1k-blocks” is the size that is represented in one-kilo blocks and the free and used storage of the mounted filesystem. linux@linux-VirtualBox:~$ sudo df -T Filesystem Type 1K-blocks Used Available Use% Mounted on udev devtmpfs 1970752 0 1970752 0% /dev tmpfs tmpfs 401852 1360 400492 1% /run /dev/sda5 ext4 25107716 9980164 13826816 42% / tmpfs tmpfs 2009244 0 2009244 0% /dev/shm tmpfs tmpfs 5120 4 5116 1% /run/lock tmpfs tmpfs 2009244 0 2009244 0% /sys/fs/cgroup /dev/loop0 squashfs 128 128 0 100% /snap/bare/5 /dev/loop1 squashfs 10112 10112 0 100% /snap/glances/1243 /dev/loop2 squashfs 64896 64896 0 100% /snap/core20/1778 /dev/loop3 squashfs 64768 64768 0 100% /snap/core20/1738 /dev/loop4 squashfs 10240 10240 0 100% /snap/glances/1168 /dev/loop5 squashfs 354688 354688 0 100% /snap/gnome-3-38-2004/115 /dev/loop6 squashfs 354688 354688 0 100% /snap/gnome-3-38-2004/119 /dev/loop7 squashfs 93952 93952 0 100% /snap/gtk-common-themes/1535 /dev/loop8 squashfs 55552 55552 0 100% /snap/snap-store/558 /dev/loop9 squashfs 47104 47104 0 100% /snap/snap-store/638 /dev/loop10 squashfs 50816 50816 0 100% /snap/snapd/17883 /dev/sda1 vfat 523248 4 523244 1% /boot/efi tmpfs tmpfs 401848 28 401820 1% /run/user/1000 Step: 02 We shall type the man df statement on the terminal to obtain extra knowledge about the “df” statement: linux@linux-VirtualBox:~$ man df Technique 07: The “fstab” Command This technique will hold the static information of the filesystem in Linux. Step: 01 We first write the “cat” command so that we can access the filesystem information and then we write the path /etc/fstab. linux@linux-VirtualBox:~$ cat /etc/fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda5 during installation UUID=6e3d13f8-16f7-4e12-bff8-8ca1bbb6d0bd / ext4 errors=remount-ro 0 1 # /boot/efi was on /dev/sda1 during installation UUID=58C9-7606 /boot/efi vfat umask=0077 0 1 /swapfile none swap sw 0 0 Step: 02 The following command can be used to dig deeply into the “fstab” statement: linux@linux-VirtualBox:~$ man fstab Technique 08: The “lsblk” Command The “lsblk” technique is utilized to show data on block devices, which except for RAM discs, are essentially files that indicate linked devices. Step: 01 We have used “-f” in the command so that we can represent the arguments of the files. linux@linux-VirtualBox:~$ lsblk -f NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT loop0 squash 0 100% /snap/bare loop1 squash 0 100% /snap/glan loop2 squash 0 100% /snap/core loop3 squash 0 100% /snap/core loop4 squash 0 100% /snap/glan loop5 squash 0 100% /snap/gnom loop6 squash 0 100% /snap/gnom loop7 squash 0 100% /snap/gtk- loop8 squash 0 100% /snap/snap loop9 squash 0 100% /snap/snap loop10 squash 0 100% /snap/snap sda ├─sda1 │ vfat 58C9-7606 511M 0% /boot/efi ├─sda2 │ └─sda5 ext4 6e3d13f8-16f7-4e12-bff8-8ca1bbb6d0bd 13.2G 40% / sr0 Step: 02 Use the command below to see the additional information on the “lsblk” statement: linux@linux-VirtualBox:~$ man lsblk” Technique 09: The “udevadm” Command The udevadm command is one of the techniques which we are going to use to check the filesystem type. The udev library is queried for device information using the udevadm command. But it also contains information about the filesystem type in Linux. Step 01: To check the file system type, the very first command we are going to use is the “udevadm” command in the Linux terminal. Write the following command in the Linux terminal: linux@linux-VirtualBox:~$ udevadm info –query=property /dev/sda1 | egrep “DEVNAME|ID_FS_TYPE” We have used the above command to query the database for the desired file type of device data with the “—query” statement. If we simply write the “udevadm –query”, the terminal will show us a lengthy output. This is why we have to use the “grep” statement that will show the necessary information to determine the file system type by further writing the “/dev/sda1” path. DEVNAME=/dev/sda1 ID_FS_TYPE=vfat Step 02: To get further details about the “udevadm” command in the Linux, we will use the “man” command in the Linux terminal: linux@linux-VirtualBox:~$ man udevadm The udevadm command will be opened into a new terminal of the Linux as shown below in the snapshot: Conclusion We have learned what is filesystem and how to check the type of mounted filesystem in Linux. We have discussed the different techniques of the mounted filesystem by writing every command of the filesystem type in the Linux terminal. View the full article
  5. Removable USB drives allow you to easily transfer the files from one system to another. When you plug in a USB drive to your system’s USB port, it automatically mounts it. In Linux, it is mounted usually under the “/media” directory and can be accessed using the File Manager. However, in some scenarios, your system may not mount the USB drive automatically after you plug it in and you will be required to mount it manually in order to transfer the files between systems. In this post, we will describe how you can mount a USB drive in a Debian OS in case it is not detected by the system automatically. We use the Debian 11 OS to describe the procedure mentioned in this article. This procedure is also applicable to the previous Debian releases. Mounting a USB drive Step 1: Plug in the USB drive to any of the available USB ports in your computer. Step 2: Once you plugged in the USB drive, check the USB drive name and the file system type drive used. To do this, launch the terminal application in your Debian 11 OS and issue the following command: $ sudo fdisk -l You will receive an output that is similar to that in the following screenshot. Scroll down the output and you will see your USB drive possibly at the end of the output labeled as sda, sdb, sdc, sdd, etc. Note down the name of your USB drive and the file system as you may need it later. In our scenario, the USB drive name is “/dev/sdb1” and the file system is “FAT32”. Step 3: The next step is to create a directory that serves as the mount point for the USB drive. To create the mount point directory, issue the following command in the terminal: $ sudo mkdir /media/<mountpoint_name> Let’s create a mount point directory named USB under the /media directory: $ sudo mkdir /media/USB Step 4: Then, to mount the USB drive to the mount point that you created, issue the following command in the terminal: $ sudo mount <device_name> <mountpoint_directory> In our scenario, we will mount the USB drive /dev/sdb1 to the mount point that we created as /media/USB/. The command is as follows: $ sudo mount /dev/sdb1 /media/USB/ Step 5: To verify if the USB drive is mounted on the mount point successfully, issue the following command: $ mount | grep <USB_drive_name> In our scenario, the command would be: $ mount | grep sdb1 The output in the following screenshot shows that our USB drive /dev/sdb1 has been mounted on the mount point /media/USB. In case the command does not show any output, it means that the device is not mounted. Step 6: To explore the mounted USB drive, move inside the mounted directory using the cd command: $ cd /media/USB/ Now, you can navigate the directories in the USB drive in the same way as you do with the other directories in your file system. To list the files in the USB, use the ls command. You can also access and explore the USB drive through the File manager of your system. Auto-Mount the USB Drive in Debian 11 You can also auto-mount the USB drive when it is plugged into the system. To do this, edit the /etc/fstab file in a text editor using the following command: $ sudo nano /etc/fstab Add the following entry at the end of the file, replacing the /dev/sdb1 and vfat with your USB device name and filesystem: /dev/sdb1 /media/USB vfat defaults 0 0 Then, save and exit the text editor. Now, run the following command to mount all the devices: $ mount -a This command mounts all the USB drives that are added to the /etc/fstab file but have not yet been mounted. Also, the next time you restart your system with a USB drive plugged in, your USB drive will be automatically mounted. Unmounting a USB Drive If you no longer want to use the mounted USB drive, you can unmount or detach it. However, before attempting to unmount it, make sure that there are no other operations in progress on the mounted USB drive. Otherwise, the drive won’t detach and you’ll get an error message. To unmount the USB drive, type umount followed by the mount point directory or the device name as follows: $ sudo umount <mountpoint_directory> Or $ sudo umount <USB_drive_name> In our scenario, it would be: $ sudo umount /media/USB If you see no output, it means that all went well and your USB drive is unmounted from the system. You can also confirm it from your File Manager’s left sidebar. To delete the mount point directory, issue the following command: $ sudo rmdir <mountpoint_directory> Conclusion In this article, you learned how to mount a USB drive in a Debian OS and how to unmount it when you need to remove the drive. I hope it will be helpful whenever you need to mount/unmount a USB drive in your system. View the full article
  6. CDs and DVDs are slowly becoming irrelevant, but they are still efficient data storage devices. They can store data in a large quantity for long periods of time. In this article, we will discuss the mounting process of CD-ROM on CentOS 8 step-by-step. The method we will perform in this article will also work if you want to mount an ISO file on CentOS 8 system. Step 1: Login as a Root User In case you’re not a root user or do not have Sudo privileges, please use the command below to log in as a root user: $ su You will be asked to input the root password. In case you fail to provide the password, you will not be able to mount the CD-ROM using the commands given in this article since this requires Sudo privileges. Step 2: Know the Block Device Name Now that you have logged in as a root user, you will be able to use the blkid command to look at the contents of block devices. Block devices are storage devices like CD ROMs, Hard Drives, and Floppy Disks. # blkid The output will look something like the screenshot attached below: My CD is not showing here, as I have not inserted it yet. Now, if I use the blkid command again after inserting the CD, the output will have an additional device in the list of block devices: # blkid The device in this example is named /dev/sr0. Please note the block device name you want to mount and its UUID. Step 3: Create a Mount Point Directory We need to make a new directory that will act as the mount point for your CD/DVD. Therefore, create a new directory using the mkdir command (any arbitrary directory). In this example, we will use /media/mount: # mkdir /media/mount Step 4: Mount CD/DVD Drive Now, we have everything to mount a CD/DVD on our CentOS 8 system. We will use the mount command to mount the CD/DVD on CentOS 8 Operating system: # mount /dev/sr0 /media/mount/ After mounting, you will be able to access all the files on your CD/DVD drive. You can use the ls command followed by the mount point directory of CD/DVD to check whether the operation was successful or not. # ls media/mount You can also mount your CD/DVD drive permanently. Mount CD/DVD Drive Permanently To mount a CD/DVD drive permanently, use the nano command followed by /etc/fstab to open the fstab file in the nano editor. Fstab is a system configuration file in CentOS 8 located in the /etc directory: # sudo nano /etc/fstab Add the following entry in the fstab file to mount CD/DVD Drive permanently: UUID=2021-04-28-16-51-58-26 /media/mount/ iso9660 ro,user,auto 0 0 Change the UUID and mount point according to your need. UUID stands for the universally unique identifier. Save and exit the file using the keyboard shortcut “CTRL + S” and “CTRL + X” and return to the terminal. Now, you can use the “mount” command to mount your CD/DVD drive permanently: # mount /dev/sr0 /media/mount/ That’s it, Congratulations! You have permanently mounted a CD drive. Conclusion This article has a comprehensive guide on how to mount a CD/DVD ROM on a CentOS 8 system. This method given above can be used to set up any block device on your system. View the full article
  7. We already know that many filesystems are used and supported by the Linux operating system, e.g., ext2, ext3, ext4, FAT16, FAT32, and a lot more. The file system is necessary for working in the Linux and Windows operating systems. If you want to know what type of filesystem your Linux OS supports this article is meant for you. This article will give you a step-by-step guide to know what kind of filesystem is mounted in a Linux operating system. To start working, you must have any Linux distribution installed on your system. Login from your Linux system and open the command terminal. Make sure you have the “util-linux” package installed on your system to start checking the mounted filesystem. For this purpose, try the below “apt” command followed by the keyword “install” in a shell. Instantly, the installation will be completed, and you can now check the mounted filesystem. $ sudo apt install util-linux There are many methods available to check the file system on your system. We will illustrate each one of them one by one. Method 01: Using Findmnt Command Our first and most used way in the Linux system to know the filesystem type is the “findmnt” command. The “findmnt” command helps us find all the mounted filesystems. Let’s start working on it. To see the list of mounted filesystems, type the simple “findmnt” command in the shell as below, which will list all the filesystems in a tree-type format. This snapshot contains all the necessary details about the filesystem; its type, source, and many more. It is clear from the image that our main filesystem is “ext4”. $ findmnt Let us display the filesystems in a simple format using the below “findmnt” command with a “-l” flag. $ findmnt -l We can list the type of our mounted filesystem using the findmnt command along with the “-t” flag followed by the name of the filesystem, e.g., “ext4”. So, execute the below-stated command in the shell. The output shows the information regarding the “ext4” filesystem. $ findmnt –t ext4 To see the “df” style list of output about the filesystem, you have to use the below command. You can see that it will show extra information regarding the filesystems and their sources. $ findmnt --df You can use the modified form of this command as follows: $ findmnt -D If you want to search for the configured filesystem in a particular device, you can do so using the below command. You can see that the output shows the “vfat” type filesystem for the specific device. $ findmnt /dev/sda1 If you want to see the mount point of a filesystem, try using the below “findmnt” command followed by the backslash “/” sign. $ findmnt / If you want to know more details about the filesystem, use the man command as follows: $ man findmnt The output is shown below. Method 02: Using Blkid Command In most cases, the “findmnt” command will be enough in knowing the filesystem’s type, but there are some alternative commands for this purpose. One of them is the “blkid” command which we don’t need to mount. After the execution of the “blkid” command below, along with the “sudo” keyword, we will be able to display all the block devices along with the filesystem type. $ sudo blkid We can use the “blkid” command to know the filesystem for the particular device. $ sudo blkid /dev/sda1 To see extra details about the filesystem, try the below command: $ sudo blkid –po udev /dev/sda1 For further details try the man command below: $ man blkid The output is given below. Method 03: Using DF Command The DF command is cast-off to know the disk space usage of the filesystem. Use it with the “-T” flag to know all the filesystem’s types. $ df -T Go through the man page to know more. $ man df The detail is given in the snapshot. Method 04: Using File Command Another method to check the mounted file system is using the “file” command in the shell. You can use it for files having no extension. Hence, execute the below command to know the filesystem for a partition. It may require your password to function. $ sudo file –sL /dev/sda1 To have extra information, try the below man command in the shell. $ man file You can see the details on the main page as shown in the appended image. Method 05: Usinf Fsck Command The “fsck” command may be used to verify or restore the reliability of a filesystem by providing the partition as an argument. You will decide what sort of filesystem it is. $ fsck –N /dev/sda1 For further details, have a look at the main page. $ man fsck And you can see the details shown below. Method 06: Using Fstab Command Another new way to view the filesystem is using the “fstab” in the cat command. Therefore, try executing the below cat command in the shell. $ cat /etc/fstab For extra details, try the same man command along with the keyword “fstab”. $ man fstab Now you will be having details about the filesystem, as shown in the image attached. Method 07: Using Lsblk Command The “lsbkl” command will show the filesystem types and the devices. $ lsblk -f Run the below man command to see the details. $ man lsblk And the extra information regarding the filesystem is displayed below. Method 08: Using grep Command Last but not least, the “grep” command is used to check the filesystem. $ mount | grep “^/dev” Conclusion: We have done all the commands to check the mounted filesystem. I hope you can easily check the mounted filesystem in your Linux distribution. View the full article
  8. Like any other filesystems, the Btrfs filesystem also has a lot of mount options that you can use to configure the Btrfs filesystem’s behavior while mounting the filesystem. This article will show you how to mount a Btrfs filesystem with your desired mount options. I will explain some of the useful Btrfs mount options as well. So, let’s get started. Abbreviations ACL – Access Control List RAID – Redundant Array of Independent/Inexpensive Disks UUID – Universally Unique Identifier Where to Put Btrfs Mount Options You can mount a Btrfs filesystem using the mount command-line program or the /etc/fstab file at boot time. You can configure the behavior of the Btrfs filesystem using mount options. In this section, I am going to show you how to mount a Btrfs filesystem using different mount options: from the command-line. using the /etc/fstab From the command-line, you can mount a Btrfs filesystem (created on the sdb storage device) on the /data directory with the mount options option1, option2, option3, etc. as follows: $ sudo mount -o option1,option2,option3,… /dev/sdb /data To mount the same Btrfs filesystem at boot time using the /etc/fstab file, you need to find the UUID of the Btrfs filesystem. You can find the UUID of the Btrfs filesystem with the following command: $ sudo blkid --match-token TYPE=btrfs As you can see, the UUID of the Btrfs filesystem created on the sdb storage device is c69a889a-8fd2-4571-bd97-a3c2e4543b6b. Open the /etc/fstab file with the following command: $ sudo nano /etc/fstab To automatically mount the Btrfs filesystem that has the UUID c69a889a-8fd2-4571-bd97-a3c2e4543b6b on the /data directory with the mount options option1,option2,option3, etc., add the following line at the end of the /etc/fstab file. UUID=c69a889a-8fd2-4571-bd97-a3c2e4543b6b /data btrfs option1,option2,option3,… 0 0 Once you’re done, press <Ctrl> + X followed by Y and <Enter> to save the /etc/fstab file. Your Btrfs filesystem should be mounted with your desired mount options. Important Btrfs Mount Options In this section, I am going to explain some of the important Btrfs mount options. So, let’s get started. The most important Btrfs mount options are: 1. acl and noacl ACL manages user and group permissions for the files/directories of the Btrfs filesystem. The acl Btrfs mount option enables ACL. To disable ACL, you can use the noacl mount option. By default, ACL is enabled. So, the Btrfs filesystem uses the acl mount option by default. 2. autodefrag and noautodefrag Defragmenting a Btrfs filesystem will improve the filesystem’s performance by reducing data fragmentation. The autodefrag mount option enables automatic defragmentation of the Btrfs filesystem. The noautodefrag mount option disables automatic defragmentation of the Btrfs filesystem. By default, automatic defragmentation is disabled. So, the Btrfs filesystem uses the noautodefrag mount option by default. 3. compress and compress-force Controls the filesystem-level data compression of the Btrfs filesystem. The compress option compresses only the files that are worth compressing (if compressing the file saves disk space). The compress-force option compresses every file of the Btrfs filesystem even if compressing the file increases its size. The Btrfs filesystem support many compression algorithms and each of the compression algorithm has different levels of compression. The Btrfs supported compression algorithms are: lzo, zlib (level 1 to 9), and zstd (level 1 to 15). You can specify what compression algorithm to use for the Btrfs filesystem with one of the following mount options: compress=algorithm:level compress-force=algorithm:level For more information, check my article How to Enable Btrfs Filesystem Compression. 4. subvol and subvolid These mount options are used to separately mount a specific subvolume of a Btrfs filesystem. The subvol mount option is used to mount the subvolume of a Btrfs filesystem using its relative path. The subvolid mount option is used to mount the subvolume of a Btrfs filesystem using the ID of the subvolume. For more information, check my article How to Create and Mount Btrfs Subvolumes. 5. device The device mount option is used in multi-device Btrfs filesystem or Btrfs RAID. In some cases, the operating system may fail to detect the storage devices used in a multi-device Btrfs filesystem or Btrfs RAID. In such cases, you can use the device mount option to specify the devices that you want to use for the Btrfs multi-device filesystem or RAID. You can use the device mount option multiple times to load different storage devices for the Btrfs multi-device filesystem or RAID. You can use the device name (i.e., sdb, sdc) or UUID, UUID_SUB, or PARTUUID of the storage device with the device mount option to identify the storage device. For example, device=/dev/sdb device=/dev/sdb,device=/dev/sdc device=UUID_SUB=490a263d-eb9a-4558-931e-998d4d080c5d device=UUID_SUB=490a263d-eb9a-4558-931e-998d4d080c5d,device=UUID_SUB=f7ce4875-0874-436a-b47d-3edef66d3424 6. degraded The degraded mount option allows a Btrfs RAID to be mounted with fewer storage devices than the RAID profile requires. For example, the raid1 profile requires 2 storage devices to be present. If one of the storage devices is not available in any case, you use the degraded mount option to mount the RAID even though 1 out of 2 storage devices is available. 7. commit The commit mount option is used to set the interval (in seconds) within which the data will be written to the storage device. The default is set to 30 seconds. To set the commit interval to 15 seconds, you can use the mount option commit=15 (let’s say). 8. ssd and nossd The ssd mount option tells the Btrfs filesystem that the filesystem is using an SSD storage device, and the Btrfs filesystem does the necessary SSD optimization. The nossd mount option disables SSD optimization. The Btrfs filesystem automatically detects whether an SSD is used for the Btrfs filesystem. If an SSD is used, the ssd mount option is enabled. Otherwise, the nossd mount option is enabled. 9. ssd_spread and nossd_spread The ssd_spread mount option tries to allocate big continuous chunks of unused space from the SSD. This feature improves the performance of low-end (cheap) SSDs. The nossd_spread mount option disables the ssd_spread feature. The Btrfs filesystem automatically detects whether an SSD is used for the Btrfs filesystem. If an SSD is used, the ssd_spread mount option is enabled. Otherwise, the nossd_spread mount option is enabled. 10. discard and nodiscard If you’re using an SSD that supports asynchronous queued TRIM (SATA rev3.1), then the discard mount option will enable the discarding of freed file blocks. This will improve the performance of the SSD. If the SSD does not support asynchronous queued TRIM, then the discard mount option will degrade the SSD’s performance. In that case, the nodiscard mount option should be used. By default, the nodiscard mount option is used. 11. norecovery If the norecovery mount option is used, the Btrfs filesystem will not try to perform the data recovery operation at mount time. 12. usebackuproot and nousebackuproot If the usebackuproot mount option is used, the Btrfs filesystem will try to recover any bad/corrupted tree root at mount time. The Btrfs filesystem may store multiple tree roots in the filesystem. The usebackuproot mount option will scan for a good tree root and use the first good one it finds. The nousebackuproot mount option will not check or recover bad/corrupted tree roots at mount time. This is the default behavior of the Btrfs filesystem. 13. space_cache, space_cache=version, nospace_cache, and clear_cache The space_cache mount option is used to control the free space cache. Free space cache is used to improve the performance of reading the block group free space of the Btrfs filesystem into memory (RAM). The Btrfs filesystem supports 2 versions of the free space cache: v1 (default) and v2 The v2 free space caching mechanism improves the performance of big filesystems (multi terabytes in size). You can use the mount option space_cache=v1 to set the v1 of the free space cache and the mount option space_cache=v2 to set the v2 of the free space cache. The clear_cache mount option is used to clear the free space cache. When the v2 free space cache is created, the cache must be cleared to create a v1 free space cache. So, to use the v1 free space cache after the v2 free space cache is created, the clear_cache and space_cache=v1 mount options must be combined: clear_cache,space_cache=v1 The nospace_cache mount option is used to disable free space caching. To disable the free space caching after the v1 or v2 cache is created, the nospace_cache and clear_cache mount option must be combined: clear_cache,nosapce_cache 14. skip_balance By default, interrupted/paused balance operation of a multi-device Btrfs filesystem or Btrfs RAID will be automatically resumed once the Btrfs filesystem is mounted. To disable automatic resuming of interrupted/paused balance operation on a multi-device Btrfs filesystem or Btrfs RAID, you can use the skip_balance mount option. 15. datacow and nodatacow The datacow mount option enables the Copy-on-Write (CoW) feature of the Btrfs filesystem. It is the default behavior. If you want to disable the Copy-on-Write (CoW) feature of the Btrfs filesystem for the newly created files, mount the Btrfs filesystem with the nodatacow mount option. 16. datasum and nodatasum The datasum mount option enables data checksumming for newly created files of the Btrfs filesystem. This is the default behavior. If you don’t want the Btrfs filesystem to checksum the data for newly created files, mount the Btrfs filesystem with the nodatasum mount option. Conclusion This article has shown you how to mount a Btrfs filesystem with your desired mount options. I have explained some of the useful Btrfs mount options as well. References [1] The Btrfs Mount Options Manpage – man 5 btrfs View the full article
  • Forum Statistics

    43.8k
    Total Topics
    43.3k
    Total Posts
×
×
  • Create New...