Skip to content

Linux磁盘格式化ntfs

1.检查磁盘是否已被系统识别到,连接无问题

root@feiniu:~# fdisk -l
Disk /dev/nvme0n1: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: Fanxiang S500 256GB                     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
root@feiniu:~# fdisk -l /dev/sdb
Disk /dev/sdb: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD40EFZX-68A
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

2.检查是否已被挂载(为空就是没有)

root@feiniu:~# mount | grep /dev/sdb

3.显示后进行安装工具

root@feiniu:~# sudo apt-get update
root@feiniu:~# sudo apt-get install ntfs-3g

4.如果没有分区进行分区

root@feiniu:~# sudo fdisk /dev/sdb

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The size of this disk is 3.6 TiB (4000787030016 bytes). DOS partition table format cannot be used on drives for volumes larger than 2199023255040 bytes for 512-byte sectors. Use GUID partition table format (GPT).
The device contains 'ntfs' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Command (m for help): m

Help:

  DOS (MBR)
   a   toggle a bootable flag
   b   edit nested BSD disklabel
   c   toggle the dos compatibility flag

  Generic
   d   delete a partition
   F   list free unpartitioned space
   l   list known partition types
   n   add a new partition
   p   print the partition table
   t   change a partition type
   v   verify the partition table
   i   print information about a partition

  Misc
   m   print this menu
   u   change display/entry units
   x   extra functionality (experts only)

  Script
   I   load disk layout from sfdisk script file
   O   dump disk layout to sfdisk script file

  Save & Exit
   w   write table to disk and exit
   q   quit without saving changes

  Create a new label
   g   create a new empty GPT partition table
   G   create a new empty SGI (IRIX) partition table
   o   create a new empty MBR (DOS) partition table
   s   create a new empty Sun partition table

   Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)

Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-4294967295, default 2048): 2048-4294967295
Value out of range.
First sector (2048-4294967295, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-4294967295, default 4294967295): 

Created a new partition 1 of type 'Linux' and of size 2 TiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

root@feiniu:~# fdisk -l
Disk /dev/sdb: 3.64 TiB, 4000787030016 bytes, 7814037168 sectors
Disk model: WDC WD40EFZX-68A
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start        End    Sectors Size Id Type
/dev/sdb1        2048 4294967295 4294965248   2T 83 Linux

5.使用强制格式化分区(等待完成即可)

root@feiniu:~# sudo mkntfs -F /dev/sdb1
Failed to set locale, using default 'C'.
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes:   4%