별의 공부 블로그 🧑🏻‍💻
728x90
728x170

터미널에서 명령어를 사용하여 강제로 디스크를 초기화하는 방법

들어가며

  • [Launchpad] -> [디스크 유틸리티] 에서 NTFS 형식의 외장 하드를 포맷(초기화)하려고 하였으나 계속 오류가 떴다.
  • 그래서 구글링을 통해 터미널에서 명령어를 사용하여 강제로 디스크를 초기화하는 방법을 찾아내었다.

 

방법

  • 터미널에 접속한 후, 다음 명령을 사용하여 초기화 할 디스크의 장치명을 알아낸다.
# diskutil list

 

/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         251.0 GB   disk0
   1:             Apple_APFS_ISC ⁨⁩                        524.3 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk3⁩         245.1 GB   disk0s2
   3:        Apple_APFS_Recovery ⁨⁩                        5.4 GB     disk0s3

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +245.1 GB   disk3
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD⁩            15.2 GB    disk3s1
   2:              APFS Snapshot ⁨com.apple.os.update-...⁩ 15.2 GB    disk3s1s1
   3:                APFS Volume ⁨Preboot⁩                 352.2 MB   disk3s2
   4:                APFS Volume ⁨Recovery⁩                789.6 MB   disk3s3
   5:                APFS Volume ⁨Data⁩                    64.2 GB    disk3s5
   6:                APFS Volume ⁨VM⁩                      20.5 KB    disk3s6

/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *120.0 GB   disk4
   1:               Windows_NTFS ⁨⁩                        120.0 GB   disk4s1

 

  • 다음 명령어를 사용하여 초기화를 진행한다.
    • # diskutil eraseDisk [포맷형식] [장치명] 디스크
    • 나는 장치명이 disk4인 디스크를 제거(Erase)한 후, 장치명이 120gb-msd이 되도록 설정하였다.
      • 포맷 형식 : Mac OS 확장 (저널링 형식)
# diskutil eraseDisk JHFS+ 120GB-SSD disk4
Started erase on disk4
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk4s2 as Mac OS Extended (Journaled) with name 120gb_msd
Initialized /dev/rdisk4s2 as a 111 GB case-insensitive HFS Plus volume with a 16384k journal
Mounting disk
Finished erase on disk4

 

  • 성공적으로 디스크가 초기화된 것을 확인할 수 있다.

 

참고

  • diskutil eraseDisk 정보 확인
# diskutil eraseDisk --help
Usage:  diskutil eraseDisk format name [APM[Format]|MBR[Format]|GPT[Format]]
        MountPoint|DiskIdentifier|DeviceNode
(Re)-partition a whole disk (create a new partition map). This completely
erases any existing data on the given whole disk; all volumes on this disk
will be destroyed. Format is the specific file system name you want to erase it
as (HFS+, etc.). Name is the (new) volume name (subject to file system naming
restrictions), or can be specified as %noformat% to skip initialization
(newfs). You cannot erase the boot disk.
Ownership of the affected disk is required.
Example: diskutil eraseDisk JHFS+ UntitledUFS disk3

 

  • Format names are of the form jhfs+, HFS+, MS-DOS, etc.; a list of formattable file systems (more precisely, specific file system personalities exported by the installed file system bundles) and common aliases is available from the listFilesystems verb.

 

  • 포맷(format) 형식
    • JHFS+ : Mac OS Extended Journaled
    • HFS+ : Mac OS Extended
    • FAT32 : MS-DOS fat32
    • ExFAT

 

참고 사이트

728x90
그리드형(광고전용)
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️
starrykss
starrykss
별의 공부 블로그 🧑🏻‍💻


📖 Contents 📖