How do I make 1 empty partition out of an external USB disk?
-
26-05-2021 - |
Вопрос
I made a mistake with dd
and now my external USB disk looks as follows:
$ diskutil list
(... output ...)
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *4.0 TB disk2
1: Apple_HFS BLA 268.4 MB disk2s1
2: Linux 1.6 GB disk2s2
Now when I open the disk in Disk Utility, it only shows 268.4 MB, not the full 4 TB it should be. I can't seem to fix it in Disk Utility, but I'm sure it can be done using the command line?
The output of gpt
is as follows:
~$ sudo gpt -r show /dev/disk2
start size index contents
0 1 MBR
1 8191
8192 524288 1 MBR part 175
532480 3080192 2 MBR part 131
3612672 7810357248
I sense that the solution is something like overwriting the whole disk with zeroes using dd
and /dev/zero
, but after my previous failure I am now scared that I brick the disk permanently.
Решение
This will erase all data that currently exists on the USB drive:
- Remove your USB drive.
- Open Disk Utility.
- In the menu bar, click [View] > [Show All Devices].
- Insert your USB drive. You should see the drive appear in the sidebar in Disk Utility as an item whose name is the manufacturer name and model name/number of the drive. Click this item to select it.
- Click [Erase] in the top bar.
- Enter a name of your choosing.
- For the format, choose "MS-DOS (FAT)".
- For the scheme, choose "GUID Partition Table". This is required since your drive exceeds 2TiB in size.
- Click [Security Options...], move the slider to "Fastest", then click "OK".
- Click [Erase].
macOS will enforce the creation of a 200MiB EFI System Partition on GPT-formatted drives. If you want to claim this space, you can either:
format the drive using another tool of another OS (e.g. Windows Disk Management, GParted for Linux); or
use the
gpt
command (or an equivalent likegdisk
) to manually create a single partition which spans the whole drive, which you will then need to format with a filesystem, e.g. create a FAT32 filesystem usingnewfs_msdos
. If you want to create an EXT filesystem, themkfs.ext?
commands (e.g.mkfs.ext4
) can be obtained via Homebrew by runningbrew install e2fsprogs
.