Creating an HFS+ Partition from the AppleTV/OS-X Command Line

Filed under: TechNotes, AppleTV — lars @ 06:37:07 pm

I just got a new 1 Terabyte hard-drive to use as an external USB drive with my AppeTV. Unfortunately, I don't have a Mac with which to partition this drive with HFS+ - the Mac file system. But it's straight-forward to do this on the AppleTV itself using the following command-line steps. The below was performed on an AppleTV 2.1 after having run nitoTV's Smart Installer. I assume the following would work on a real Mac too.

  1. Plug the new HD in to your AppleTV's USB port and login via SSH.
  2. The first step is to identify which disk it is you want to partition. You can do this by running the following command:
    ls -al /dev/disk*
    You should see some output like this:
    brw-r-----   1 root      operator   14,   0 Nov 23 16:08 /dev/disk0
    brw-r----- 1 root operator 14, 1 Nov 23 16:08 /dev/disk0s1
    brw-r----- 1 root operator 14, 2 Nov 23 16:08 /dev/disk0s2
    brw-r----- 1 root operator 14, 3 Nov 23 16:08 /dev/disk0s3
    brw-r----- 1 root operator 14, 4 Nov 23 16:08 /dev/disk0s4
    brw-r----- 1 frontrow operator 14, 5 Nov 23 16:08 /dev/disk1
    As you can see, disk0 has 4 partitions. This is the internal AppleTV drive. disk1 has no partitions, which means it's your new unpartitioned drive.
  3. Now run the following to partition this disk:
    sudo diskutil partitionDisk /dev/disk1 1 HFS+ MyDrive 1000gb
    Where 'MyDrive' is the name of your new partition and '1000gb' is the size. This should give output something like this:
    Started partitioning on disk disk1
    Creating Partition Map
    5% ..Formatting Disk
    100% ..
    Finished partitioning on disk disk1
    #: type name size identifier
    0: GUID_partition_scheme *931.5 GB disk1
    1: EFI 34.0 MB disk1s1
    2: Apple_HFS MyDrive 931.5 GB disk1s2
    As you can see, the resulting partition is not 1000gb but 931.5gb - so it appears diskutil is forgiving enough to just create the biggest partition it can if you over-spec the size a little bit.

That's it! Remember before you unplug the drive, it's always a good idea to cleanly unmount:

sudo umount /Volumes/WD_1TB/

Also, if you're planning on plugging the drive into a linux machine, you'll need to disable journaling first:

diskutil disableJournal /Volumes/WD_1TB/

You can re-enable it later by running:

diskutil disableJournal /Volumes/WD_1TB/


  • brian

    Are you getting a lot of use out of your AppleTV? I considering whether to buy one for my wife.

    Comment by brian [Visitor] — 12/04/08 @ 10:28

  • lars
    Hi Brian,

    It's a nice device, small, quiet, pretty easy to use. But it has some limitations. For me the annoying ones are only 256MB RAM (non-upgradable as it's soldered to the motherboard) which limits how many services I can load on to it, and limited power - a lot of 720p high-definition video I want to play on it has to be re-encoded to sit within Apple's constraints on video bitrate and h.264 codec features, otherwise the AppleTV won't play it. It's a bit of fun, but sometimes I think a custom built HTPC might be a better way to go.

    Comment by lars [Member] — 12/08/08 @ 02:10

Leave a comment

Allowed XHTML tags: <p, ul, ol, li, dl, dt, dd, address, blockquote, ins, del, span, bdo, br, em, strong, dfn, code, samp, kdb, var, cite, abbr, acronym, q, sub, sup, tt, i, b, big, small>

(Line breaks become <br />)
(Set cookies for name, email & url)

powered by  b2evolution