To format a new partition, you can use the mkfs command. Here’s how to do it:
-
First, identify the new partition you created. It will typically be named something like
/dev/sdX1, whereXis the letter of your disk and1is the partition number. -
Open a terminal and run the following command to format the partition. Replace
/dev/sdX1with your actual partition name and choose the desired filesystem type (e.g.,ext4,ntfs,vfat):sudo mkfs.ext4 /dev/sdX1For example, to format as NTFS:
sudo mkfs.ntfs /dev/sdX1 -
After formatting, you can mount the partition to a directory. Create a mount point if it doesn't exist:
sudo mkdir /mnt/my_partition -
Then mount the partition:
sudo mount /dev/sdX1 /mnt/my_partition -
To make the mount persistent across reboots, you can add an entry to
/etc/fstab.
Always ensure you have backed up important data before formatting, as this process will erase all data on the partition.
