How to Format External 3TB Hard Drive as ext4 via Command Line (CLI)?

7,965

If you performed the steps you listed, then you have a filesystem on the drive. parted doesn't show it because the drive uses 4k sectors, and parted currently only detects filesystems on disks with 512 byte sectors.

Share:
7,965

Related videos on Youtube

tarabyte
Author by

tarabyte

Updated on September 18, 2022

Comments

  • tarabyte
    tarabyte over 1 year

    I know there are several similar questions out there, but many of the answers are terrible.

    I guess fdisk can NOT support drives larger than 2TB? The interactive menu changed on me so I don't know what to do now. It asks me for first cylinder and last cylinder. I just want to make the whole thing ext4 for backups of my ubuntu box.

    I don't understand why I can't get a filesystem on my hard drive. This is the output of sudo parted -l after I complete the first trial. enter image description here

    # Install gdisk
    sudo apt-get install gdisk
    
    # Partition the external hard drive
    sudo parted -l        # inspect your drive's name and make sure it is the external one!
    sudo umount /dev/sdx1 # ensure that drive is NOT mounted
    sudo gdisk /dev/sdx1  # launch gdisk on the drive of interest
    ?       # explore the features gdisk offers
    n       # create a [n]ew partition
    [enter] # choose default partition number
    [enter] # choose default first sector
    [enter] # choose default last sector
    [enter] # choose default, linux filesystem (8300)
    v       # verify
    c       # change the name of the partition, e.g. MY_BACKUP_3TB
    p       # print to ensure the renaming is to your liking
    w       # write the changes to disk
    
    # Reboot (got warning that I needed to so kernal can recognize the change)
    sudo reboot
    
    # Format the hard drive
    sudo mkfs -t ext4 /dev/sdx1 # create the filesystem as type ext4
    
    # Inspect the results
    sudo parted -l
    
  • tarabyte
    tarabyte about 10 years
    no access to GUI. I'll make that clearer in the question. This is a Ubuntu Server box.