Previously, the editor transitioned from a dual-system approach to employing WSL2+MobaXterm. Nevertheless, this Windows-based Linux subsystem still imposed noteworthy limitations during various tasks. It’s not solely an issue concerning the graphical interface; the utilization of MobaXterm’s X11 server effectively resolves that concern. The primary challenge lies in WSL’s constraints on specific software package versions, a hurdle that can prove rather formidable. Consequently, opting for a dual-system configuration emerges as the more prudent choice.
In this iteration of configuring a dual system, the editor gleaned valuable insights from past missteps, achieving a more comprehensive understanding of previously obscure aspects. I trust that this newfound knowledge will prove beneficial to you.
Since this post is being composed well over a month after the installation of the dual system by the editor, there are no accompanying visual materials. However, my focus will be dedicated to sharing insights on widely discussed topics.
01
How should the System Partitions be Allocated?
This is undoubtedly one of the questions that trouble many people because there is inconsistent information online, and there are very few specific explanations provided. Some partition schemes also make people very concerned about memory, to the point where they question whether this allocation method is suitable.
The Whole Process
When installing Ubuntu as a dual system on a computer that already has Windows installed, you can allocate space to the Ubuntu system by following these steps:
- Open the
Windows system
and launchDisk Management
. - In
Disk Management
, locating thedisk partition
where Ubuntu is currently installed. You can identify it based on factors likedisk size
andfile system type
. - Right-click on that
disk partition
and choose ‘Shrink Volume
.’ - In the
pop-up dialog box
, input the amount of space you want to allocate to the Ubuntu system inMB
. Note that you should reserve some space for Ubuntu’s installation and operation; it’s recommended to allocate at least 20GB of space. - Click the ‘
Shrink
‘ button and wait for Disk Management to complete the space allocation process. - Launch the Ubuntu system’s installer and select ‘
Something Else
‘ on the partition selection screen. - In the list of partitions, locate the space you allocated for Ubuntu, select it, and click the ‘
New Partition
‘ button. - In the
pop-up dialog box
, choose thepartition's size
andfile system type
, with ext4 being a recommended choice. - Click the ‘
OK
‘ button to create the partition. - In the partition list, find the newly created partition, select it, and mount it as ‘
/root
.’ - Click the ‘
Install
‘ button and wait for the Ubuntu system’s installer to complete the installation process.
These are the steps for allocating space to the Ubuntu system when installing it as a dual system on a computer with Windows already installed. It’s important to note that before performing any disk partition operations, it’s advisable to back up important data.
Is it necessary to allocate separate sizes for different partitions in Ubuntu, such as root, home, and others?
When partitioning an Ubuntu system, it’s typically recommended to create three main partitions: the root directory (/), a swap partition, and a /home partition. Here’s some guidance on their sizes:
- Root Directory (/): The root partition contains all files and folders of the Ubuntu system and should have enough space to ensure the system runs smoothly. It’s advisable to allocate at least 20GB or more to the root partition to ensure that Ubuntu can be installed and operate effectively.
- Swap Partition: The swap partition is used to store unused memory data, which can enhance system performance and stability. It’s recommended to size the swap partition at 1.5 times the capacity of your RAM. For instance, if your computer has 8GB of RAM, you can set the swap partition to 12GB.
- /home Partition: The /home partition is for storing user files and settings. If you have multiple users on your Ubuntu system or need to store a significant amount of files and data, it’s a good idea to create a separate /home partition. The size of the /home partition should ideally accommodate the total size of the files and data you plan to store, plus some reserved space.
In summary, allocating space only to the root partition can lead to issues such as disk space shortages that may affect the system’s normal operation and data storage. Therefore, it’s advisable to allocate the sizes of the root directory, swap, and /home partitions according to your specific needs and usage patterns.
If the physical memory reaches 16GB, does swap still need to be partitioned? If partitioning 24GB feels painful
If the physical memory has already reached 16GB, then there is no need to partition a swap partition for the Ubuntu system. This is because, in most cases, a swap partition is primarily used to expand the capacity of physical memory so that the system can manage memory more effectively. However, on computers with 16GB or more of physical memory, the swap partition may be rarely used, as 16GB or more of memory is already sufficient to support the operation of most applications.
However, if the computer still experiences high memory usage issues or needs to run memory-intensive tasks such as large applications or virtual machines, it is possible to partition a swap partition for the Ubuntu system. There is no need to make the swap partition excessively large, as this would waste disk space, but it should not be set too small to prevent memory shortages.
The ‘home’ directory is a directory under the root directory, why can it be partitioned separately?
/home directory is a subdirectory in the Ubuntu system’s root directory used to store users’ personal files and settings. Although the /home directory is located in the root directory, it can be partitioned separately, providing several benefits:
- Data Isolation: By separating the /home directory into its own partition, user data is kept separate from system files, increasing data isolation. This ensures that user data remains intact during system reinstallation or repartitioning.
- System Maintenance: Partitioning the /home directory separately makes system maintenance more convenient. For instance, when upgrading the system or adjusting partition sizes, you can unmount the /home partition without affecting other system files.
- Backup and Recovery: Partitioning the /home directory separately facilitates user data backup and recovery. For example, to back up user data, you only need to back up the /home partition, eliminating the need to back up the entire root directory.
In the Ubuntu system, users’ personal files and settings are typically stored in the /home directory rather than in the root directory. Therefore, if you partition the /home directory separately, files in the /home directory will no longer be located in the root directory but will be stored in the /home partition.
02
Sharing Files Between Dual Systems
Mounting Command
In the Ubuntu system, you can use the mount
command to mount a folder from the Windows system into a directory in the Ubuntu system. For instance, you can create a directory in the Ubuntu system (e.g., /mnt/windows) as a mount point and then use the following command to mount a folder from the Windows system to that directory:
sudo mount -t ntfs /dev/sda1 /mnt/windows
Among these, /dev/sda1 represents a partition of the Windows system, and ntfs is the file system type of the Windows system partition. You can replace these parameters with your own partition and file system type. After mounting, you can access files from the Windows system in the /mnt/windows directory. It’s important to note that, for stability and security, it’s recommended to perform the mounting operation with root privileges in the Ubuntu system and to unmount the mounted folder when you no longer need to access files from the Windows system. Additionally, ensure that the folders you intend to share from the Windows system have the correct permissions set for access from the Ubuntu system.
You can mount either a Windows partition or a folder, for example:
sudo mount -t ntfs /dev/sda1 /mnt/windows -o ro,umask=022,gid=1000,uid=1000
Among these, /dev/sda1 represents a partition of the Windows system, and ntfs is the file system type of the Windows system partition. /mnt/windows is the mount point in the Ubuntu system. The parameters following the -o option are some options used during mounting. For example, the ro option specifies mounting in read-only mode, umask sets default permissions for the mount point, and gid and uid options specify the user and group for the mount point.
To mount a specific folder from a Windows partition, you can replace /dev/sda1 with the path to the Windows partition and the folder name, for example:
sudo mount -t ntfs /dev/sda1/MyFolder /mnt/windows -o ro,umask=022,gid=1000,uid=1000
This way, the /dev/sda1/MyFolder folder will be mounted to the /mnt/windows directory.
It’s important to ensure that the folder you want to mount from the Windows partition has the correct permissions for access in the Ubuntu system. Additionally, when mounting a Windows partition or folder, make sure that it is not currently in use by the Windows system to avoid any risks of mounting errors or data loss.
Setting Up Shared Folders in Windows
- Open File Explorer, locate the folder you want to share and right-click on it.
- Select ‘Properties,’ then in the pop-up window, choose the ‘Sharing’ tab.
- In the Sharing window, select the ‘Share this folder’ option and give the shared folder a name.
- If you want to control permissions for others accessing this shared folder, click the ‘Permissions’ button and configure the appropriate permissions.
- Click ‘Apply’ and ‘OK’ to save the settings and close the sharing window.
Now, you have successfully set up a shared folder in Windows. Other computers can access this folder over the network by entering the shared folder’s name and the network address of the Windows computer. For instance, in an Ubuntu system, you can use the following command to mount a Windows shared folder:
sudo mount -t cifs //windows_computer_name/shared_folder /mnt/mount_point -o username=windows_username,password=windows_password
Among these, //windows_computer_name/shared_folder is the network address of the shared folder, /mnt/mount_point is the mount point in the Ubuntu system, username, and password are the username and password from the Windows system, used to authorize access to the shared folder in the Ubuntu system.
Mounting Windows Partitions or Folders Using ntfs-3g Tool
The ntfs-3g tool allows Ubuntu to access the Windows file system with read-write capabilities. Here are the steps to mount a Windows folder in Ubuntu using the ntfs-3g tool:
- Open the terminal and use the following command to install the ntfs-3g tool:
sudo apt-get install ntfs-3g
- Create an empty folder for mounting the Windows folder. For example:
sudo mkdir /mnt/windows
- Use the following command to mount the Windows folder and specify the ntfs-3g tool:
sudo mount -t ntfs-3g /dev/sda1 /mnt/windows
Here, /dev/sda1 represents the partition where the Windows folder is located, and /mnt/windows is the empty folder used for mounting the Windows folder. - After successful mounting, you can access the Windows folder in Ubuntu with read-write capabilities. For example:
sudo cp /home/user/file.txt /mnt/windows/
Here, /home/user/file.txt is the file you want to copy, and /mnt/windows/ is the destination location within the Windows folder.
Note: If you are unsure about the path of the Windows folder, you can use the following command in Ubuntu to view the mount points: mount | grep ntfs
This command will list all the mounted ntfs partitions or folders and display their mount points. Find the partition or folder where your Windows folder is located and replace it with /dev/sda1.
Related:
- Folder Icon Hard Drive: Functional Storage with Style!
- What Is Wafer Mount? Key Role in Chip Processing
Disclaimer: This article was created by the original author from CSDN. The content of the article represents their personal opinions. Our reposting is for sharing and discussion purposes only and does not imply our endorsement or agreement. If you have any objections, please contact us through the provided channels.