Mount & Partition New Hard Drive in Ubuntu
In Ubuntu, a newly added hard drive needs to be mounted and partitioned using the following steps:
- Firstly, insert the new hard drive and boot up the Ubuntu system.
- Open the terminal (Ctrl + Alt + T) and execute the following command to view all the hard drives and partitions in the system:
sudo fdisk -l
- Based on the output of the command, locate the device name of the newly added hard drive, such as /dev/sdb.
- Partition the new hard drive using the fdisk command.
sudo fdisk /dev/sdb
Under the prompt of the fdisk command, type ‘n’ to create a new partition, ‘p’ to select primary partition, ‘1’ to choose the partition number (other numbers can be chosen as needed), and then press Enter to set the starting and ending positions.
- Format the new partition.
sudo mkfs.ext4 /dev/sdb1
This will format the new partition to the ext4 file system.
- Create mounting point:
sudo mkdir /mnt/new_drive
This will create a mount point named new_drive under the /mnt directory.
- Mount the new partition to the mount point:
sudo mount /dev/sdb1 /mnt/new_drive
This will mount the new partition to the newly created mount point.
- Confirm whether the mounting was successful:
df -h
This will display all the mount points and usage in the system, ensuring that the new partition has been successfully mounted.
- To automatically mount a new partition at system startup, you can edit the /etc/fstab file and add the following line:
/dev/sdb1 /mnt/new_drive ext4 defaults 0 2
After saving and closing the file, the system will automatically mount the new partition every time it starts up.
Now, the newly added hard drive has been successfully partitioned and mounted onto the Ubuntu system.