How to add a hard disk partition in Ubuntu?
To add a hard drive partition on Ubuntu, you can follow these steps:
- Firstly, insert the hard drive and boot up the Ubuntu system.
- Open the terminal window and type the following command to view the current disk and partition situation of the system.
- Display information about all disk drives and their partitions.
- Identify the name of the hard disk device that you want to partition, such as /dev/sdb.
- Run the following command to open the disk partition tool:
- Please run the command ‘sudo fdisk /dev/sdb’
- Press the ‘n’ key to create a new partition.
- Choose the type of partition, usually selecting primary partition (p) or logical partition (l).
- Please enter the starting sector and ending sector of the partition (you may press Enter to use the default values if unsure).
- After completing the partition, press the ‘w’ key to save and exit the partition tool.
- Format the newly created partition, for example using the ext4 format.
- Create a file system of type ext4 on device /dev/sdb1 using sudo.
- Create a directory for mounting partitions.
- Create a new directory named “new_partition” in the “/mnt” directory using superuser permissions.
- Mount the new partition to the directory.
- Elevate privileges and mount the device with the name “/dev/sdb1” to the directory “/mnt/new_partition”.
- File operations can now be performed on the new partition.
Please pay attention and be cautious when partitioning your disk to avoid deleting important data or damaging the system. It is recommended to back up important data before performing any operations.