Suppose you have a completely new 4TB hard drive recently and want to add it to your computer. You need to mount it in Linux. To do this, you need to take the following steps:

  1. A. Partitioning the hard drive in Linux
  2. B. Format USB in Linux
  3. C. Mount USB in Linux (including auto mount after reboot)
  4. D. Check if the hard drive is mounted

A. Partitioning the hard drive in Linux

Step 1 : First, after connecting the hard drive to the computer with a SATA cable and power cable, you can test the new 4TB hard drive with the command:

 sudo fdisk -l 

Format and mount USB in Linux Picture 1

Step 2 : But you cannot mount it now, if you mount it immediately, an error will appear. You need to partition it first:

 sudo fdisk /dev/sdb 

Format and mount USB in Linux Picture 2

Step 3 : If you enter m for help, you can see the command list.

Format and mount USB in Linux Picture 3

Format and mount USB in Linux Picture 4

Step 4 : To check the partition table, enter p .

Format and mount USB in Linux Picture 5

Step 5 : To partition, enter n . For example then simply select the primary partition by entering p and entering 1 for only some partitions.

Format and mount USB in Linux Picture 6

Step 6 : Enter w to write the partition table to the drive.

Format and mount USB in Linux Picture 7

B. Format USB in Linux

The USB format in Ubuntu with the Terminal command is much easier than in Windows. But some Ubuntu users are not familiar with Terminal commands. This tutorial will help Ubuntu users (Linux) take simple steps to format USB.

Format and mount USB in Linux Picture 8

Step 1 : Insert the USB and determine the volume

Insert the USB into the system and determine the correct USB drive. This is a step you need to take care of, because you can format the drive incorrectly if your drive is not correctly identified.

 $ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 28G 24G 2.3G 92% / udev 1.4G 12K 1.4G 1% /dev tmpfs 277M 1.2M 276M 1% /run none 5.0M 0 5.0M 0% /run/lock none 1.4G 34M 1.4G 3% /run/shm /dev/sdc1 14.8G 1.4G 13.4G 10% /media/tecadmin 

Now, the example has determined the drive / dev / sdc1 is a 16GB USB attached.

Step 2 : Format USB in Linux

Whenever you mount USB in Ubuntu, it will automatically mount to the system. You cannot format any drive on mounted Linux systems. So first unmount the USB drive / dev / sdc1 on the system.

 sudo umount /dev/sdc1 

Now, use one of the following commands on the file system you want. To format USB, most users prefer VFAT and NTFS file systems because they can be easily used on Windows operating systems.

  1. Format with vFat file system:
 sudo mkfs.vfat /dev/sdc1 
  1. Format with NTFS file system:
 sudo mkfs.ntfs /dev/sdc1 
  1. Format with EXT4 file system:
 sudo mkfs.ext4 /dev/sdc1 

Similarly, you can format the USB flash drive with any required file system.

C. Mount USB in Linux (including auto mount after reboot)

Step 1 : Normally, the hard drive is mounted in / mnt /. Create a new folder in / mnt / first.

 sudo mkdir /mnt/sdb 

Step 2 : After that, you can mount it with the command:

 sudo mount /dev/sdb /mnt/sdb 

Format and mount USB in Linux Picture 9

Step 3 : But you need to mount it every time you reboot. To automatically mount after every reboot, we will use nano to modify the / etc / fstab file:

 nano /etc/fstab 

Step 4 : Enter the following command at the end of the file:

 /dev/sdb /mnt/sdb ext4 defaults 0 0 

Format and mount USB in Linux Picture 10

The first item is the path for the hard drive. The second is the destination of the mounted drive (where you want to mount the drive). The third is the format. The fourth to sixth items remain the same by default of 0 and 0 .

D. Check if the hard drive is mounted

There are 3 methods to test. All three methods can find the sdb mounted hard drive.

1. mount

 mount | grep sdb 

2. lsblk

 lsblk 

Format and mount USB in Linux Picture 11

3. df

 df 

Format and mount USB in Linux Picture 12

Hope you are succesful.

3.9 ★ | 18 Vote | 👨 7480 Views

Above is an article about: "Format and mount USB in Linux". Hope this article is useful to you. Don't forget to rate the article, like and share this article with your friends and relatives. Good luck!

« PREV POST
NEXT POST »