CentOS 8 Essentials
上QQ阅读APP看书,第一时间看更新

4.4 Accessing the Windows Partition from CentOS 8

When running CentOS in a dual boot configuration it is still possible to access files located on the Windows partition. This can be achieved by manually mounting the partition from the command-line. Before doing so, however, some additional packages need to be installed on the system. First the fuse kernel module needs to be downloaded and installed:

# dnf install fuse

# modprobe fuse

Next, the Fuse NTFS driver needs to be installed. Unfortunately, this package is not included in the standard CentOS 8 repositories so the Extra Packages for Enterprise Linux (EPEL) repository needs to be added to the system as follows:

# dnf install wget

# wget http://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

# rpm -ivh epel-release-latest-8.noarch.rpm

With the EPEL repository added, the driver can now be installed:

# dnf install fuse-ntfs-3g

Once the requisite packages are installed, the next step is to create a directory to use as the mount point for our Windows partition. In this example we will create a directory named /mnt/windows:

# mkdir /mnt/windows

In order to identify the device name that has been assigned to the Windows partition, use the fdisk command as follows:

# fdisk -l

.

.

   Device Boot Start End Blocks Id System

/dev/sda1 * 1 13 102400 7 HPFS/NTFS

/dev/sda2 13 1400 11141120 7 HPFS/NTFS

/dev/sda3 1400 1464 512000 83 Linux

/dev/sda4 1464 2611 9214976 5 Extended

/dev/sda5 1464 2611 9213952 8e Linux LVM

In the above output, the main Windows partition containing the files we need access to is represented by /dev/sda2. Next, we need to run the mount command (assuming the Windows partition is /dev/sda2 and NTFS format) as follows:

# mount /dev/sda2 /mnt/windows

Check that the mount was successful by listing the contents of the top level directory of the mount point:

# ls /mnt/windows

‘$Recycle.Bin’ ProgramData swapfile.sys

‘Documents and Settings’ ‘Program Files’ ‘System Volume Information’

 pagefile.sys ‘Program Files (x86)’ Users

 PerfLogs Recovery Windows

To automate the mount each time the system is booted, simply add the appropriate mount line to the /etc/fstab file:

/dev/sda2 /mnt/windows ntfs defaults 0 0

To unmount the Windows file system at any time:

umount /mnt/windows