Search the Community
Showing results for tags 'cifs'.
-
You can add/mount an SMB/CIFS share from your Windows OS or NAS device on Proxmox VE as storage for storing ISO images, container images, VM disk images, backups, etc. In this article, I am going to show you how to add a Windows SMB/CIFS share on Proxmox VE as storage. Table of Contents: Adding an SMB/CIFS Share as Storage on Proxmox VE Accessing the SMB/CIFS Storage on Proxmox VE Conclusion Adding an SMB/CIFS Share as Storage on Proxmox VE: To add an SMB/CIFS share on Proxmox VE as storage, navigate to Datacenter > Storage and click on Add > SMB/CIFS as marked in the screenshot below. Type in an ID/name for the SMB/CIFS storage[1], the domain name or IP address of the SMB/CIFS server[2], and the login username[3] and password[4] of the SMB/CIFS server. If all the details are correct, you should be able to select the SMB/CIFS share you want to add to Proxmox VE from the Share dropdown menu[5]. You can also add a subdirectory of the SMB/CIFS share on Proxmox VE. To do that, type in a subdirectory path in the Subdirectory section[6]. From the Content dropdown menu, you can select the type of data you want to store on the SMB/CIFS share. Disk image: If selected, the disks of the Proxmox VE virtual machines can be stored on this storage. ISO image: If selected, the ISO installation images of different operating systems can be stored on this storage. Container template: If selected, the LXC container template files can be stored on this storage. VZDump backup file: If selected, the Proxmox VE virtual machine and container backups can be stored on this storage. Container: If selected, the disks of the Proxmox VE LXC containers can be stored on this storage. Snippets: If selected, you can store Proxmox VE snippets on this storage. Once you’re done, click on Add. A new SMB/CIFS storage should be added to Proxmox VE[1]. You can also find the mount path of the SMB/CIFS share in the Datacenter > Storage section[2]. The SMB/CIFS storage should also be displayed in the Proxmox VE server tree[3]. Accessing the SMB/CIFS Storage on Proxmox VE: You can access only the Proxmox VE contents stored on the SMB/CIFS storage from the Proxmox VE dashboard. In the Summary section of the SMB/CIFS storage, you will see usage information of the SMB/CIFS storage. For each selected content, you will see respective sections in the SMB/CIFS storage. For example, for ISO image content type, I have a section ISO Images on my SMB/CIFS storage nas-datastore that shows all the ISO installation images that I have stored on the SMB/CIFS storage. You can access all the files of the SMB/CIFS storage on your Proxmox VE server from the command line. In this case, the nas-datastore SMB/CIFS storage is mounted in the path /mnt/pve/nas-datastore and all the files of the SMB/CIFS storage are available in that mount path. Conclusion: In this article, I have shown you how to add an SMB/CIFS share as storage on Proxmox VE. I have also shown you how to access the SMB/CIFS storage on Proxmox VE. View the full article
-
Mounting is a process of accessing files or folders through the local file system and making modifications. Windows Share is a Windows built-in feature to share files or directories with others over a local area network (LAN). In this tutorial, I will be exploring Windows Share and how to mount it on a Linux file system using the mount.cifs utility. What is CIFS CIFS also known as Common Internet File System is a dialect of SMB protocol that is developed by Microsoft to access files or folders from users over the same network connection. However, the latest SMB protocols have replaced this widely used network file-sharing protocol for mounting Windows Share on Linux. There is a specific utility called mount.cifs which is used to mount Windows Share on Linux. In the next section, I will discuss the process of installing it on Linux. How to Install CIFS-Utils on Linux To mount Windows Share on Linux mount.cifs utility is needed which is a part of the CIFS-Utils package. To install cifs-utils on Ubuntu, Debian, and distributions based on them, use the default package manager. sudo apt install cifs-utils Use the dnf package manager to install cifs-utils on CentOS and Fedora distributions, sudo dnf install cifs-utils For Red Hat (RHEL) and Red Hat-based distributions use the yum package manager. sudo yum install cifs-utils Note: For the instructions implemented in this guide, I am using Ubuntu 22.04. The process is similar and can be performed without any issue on any Linux distribution. How to Mount Windows Share on Linux We need a mount point, a directory created anywhere on the Linux system, to mount the Windows share. I am creating a /media/WinShare directory on root using mkdir command with sudo privileges. sudo mkdir /media/WinShare We will follow the below-given syntax of the mount command to mount the Windows Share on Linux. sudo mount -t cifs //[IP-ADDRESS]/[SHARE-NAME] /[MOUNT] -o username=[USERNAME] In the above syntax: [IP-ADDRESS]: It is the IP address of the remote machine, which is Windows in this case; to access the IP address, open the command prompt and run the ipconfig command. Note the IPV 4 address. [SHARE-NAME]: It is the Windows Share name or the folder name that is shared for the network. [MOUNT]: It is the mount point directory set up on the client’s machine, which is Linux. -o: This is a flag used to define cifs-utils options, to read more about the cifs utils options run man mount.cifs command. The table below lists some options that users often use. username To provide the username of the remote machine password To provide password explicitly [Not recommended] credentials To set the file containing credentials [Recommended] vers To set the protocol version explicitly 1.0, 2.0, or 3.0 Now, I have created a Windows Share with the name MyFolder, to mount it on Linux using /media/WinShare as a mount point I will use the following command. sudo mount -t cifs //192.168.18.14/MyFolder /media/WinShare -o username=shahr After executing the command you will be asked to enter the password of the remote machine. On successfully mounting the Windows Share, you will not get any alert. To verify the successful mount use the df -h command; which is essentially used to get disk space of the file system. df -h In many instances, it may be necessary to state the user domain. Find the system domain of the Windows system using the wmic (Windows Management Instrumentation Command Line) command in the command prompt. wmic computersystem get domain After knowing the domain which is WORKGROUP in my case, simply insert it in the above command using the domain option. sudo mount -t cifs //192.168.18.14/MyFolder /media/WinShare/ -o username=shahr,domain=WORKGROUP However, this is not a secure way to mount the shared folder. To make it more secure, the mount.cifs utility has an option called credentials. The credentials option allows you to set a path of a plain text file containing the credentials of the remote machine instead of explicitly mentioning the username or password. Let’s create a text file that contains the credentials of the machine to be accessed; in this case, it is the Windows machine. sudo nano ~/.credentials-cifs Type the following information in the file. username=[USERNAME] password=[PASSWORD] domain=[DOMAIN] After adding this information to the file, save the file by pressing ctrl+x and then y. To mount the Windows Share with credentials option use the following command. sudo mount -t cifs //192.168.18.14/MyFolder /media/WinShare/ -o credentials=~/.credentials-cifs Note: I will advise giving the absolute path to the credentials file instead of using ~/. How to Make the Windows Share Mount Permanent Before attempting the following section, note key important points. If the permanent mount is not properly set up, then Linux will not boot. Ensure everything is correct before reboot. I will suggest using the mount -a command to check for errors. The IP of the remote machine must be static, otherwise, the mounting will fail, and eventually the system boot. To make the Windows Share mount permanent, we need to modify the fstab (File System Table) file. The fstab file manages the file system and also allows you to mount the external file system manually. Let’s open the fstab file located in the /etc directory using the nano editor. sudo nano /etc/fstab To make Windows Share permanent on Linux, follow the syntax given below. //[IP-ADDRESS]/[SHARE-NAME] /[MOUNT] cifs credentials=[CREDENTIALS-FILE-PATH] [DUMP] [PASS] Note: Use tab instead of space to separate the fields in the fstab file. Let’s replace the [IP-ADDRESS], [SHARE-NAME], [MOUNT], and [CREDENTIALS-FILE-PATH] with actual information. The [DUMP] and the [PASS] options are used to enable backup of the mounted file system and fsck check on boot, respectively. Set 0 and 0 for both options to keep them disabled. //192.168.18.14/MyFolder /media/WinShare cifs credentials=/home/user/.credentials-cifs 0 0 Note: Provide the absolute path of the credentials file. After modifying the fstab file, save and exit the editor using ctrl+x and then y. The subsequent step involves mounting the Windows Share by means of the mount command. sudo mount /media/WinShare If there are no errors, then the mount is successful and will remain permanent even on boot. How to Unmount the Windows Share To unmount the Windows Share, use the umount command with the mount point. sudo umount /[MOUNT] In our example, the [MOUNT] is /media/WinShare directory. sudo umount /media/WinShare If the above command fails to unmount the Windows Share, then try force unmounting using the -f flag. sudo umount -f /media/WinShare Or use the -l flag, which detaches the file system if the above command also fails. sudo umount -l /media/WinShare To read more about these options, run the man mount command. How to Create Windows Share Windows Share is a directory that is set to share on a local area network. Before accessing Windows Share on Linux, it has to be set up on Windows. First, ensure that Windows is enabled for CIFS communication. For that, open the Turn Windows feature on and off on Windows. Find SMB 1.0/CIFS File Sharing Support in the list and check it. After a few moments, you will be asked to restart the system. To enable network discovery on Windows, navigate to the Advanced sharing settings; once there, you should find the option for Network discovery and ensure that this option is enabled by selecting the Turn on network discovery option. Next, we need to create a Windows Share folder that will be mounted on Linux using mount.cifs utility. Create a folder anywhere on Windows and right-click on it, and then from the context menu click on Properties. Navigate to the Sharing tab on the opened window and click on the Share button to proceed with the folder-sharing settings. Now, click on the drop-down icon, select Everyone from the list, and then click on the Add button. Select the Permission Level, set it to Read/Write to this folder, and then click on Share. Now, the Windows Share is ready to share. Conclusion If you have recently moved to Linux, then you will definitely need to access data on your Windows system. Any sort of data can be shared on Linux from Windows using the Windows Share option. To access Windows Share on Linux, the IP address and password of the Windows machine are required. Mounting the Windows Share on Linux using mount.cifs utility requires two steps. First, set the mount point on Linux and then use the mount command with the -t cifs option to mount the Windows Share on Linux. View the full article
-
Forum Statistics
63.6k
Total Topics61.7k
Total Posts