Setup external USB disk as NTFS volume on Raspbian

I intend to use an external 2.5″ USB disk formatted as NTFS volume on my Raspberry Pi. Since its rather larger (5TB) I don’t want to use MBR but GPT instead. Here’s a short list of commands I’ve used to setup the disk.

Start by identifying the connected disk:

> lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  4.6T  0 disk
└─sda1        8:1    0  4.6T  0 part
mmcblk0     179:0    0 14.9G  0 disk
├─mmcblk0p1 179:1    0  1.5G  0 part
├─mmcblk0p2 179:2    0    1K  0 part
├─mmcblk0p5 179:5    0   32M  0 part
├─mmcblk0p6 179:6    0   69M  0 part /boot
├─mmcblk0p7 179:7    0  8.2G  0 part /
├─mmcblk0p8 179:8    0  512M  0 part
└─mmcblk0p9 179:9    0  4.5G  0 part

My disk is sda.

I now usually used fdisk as a partitioning tool. However, there’s a tool I can highly recommend. Its called parted and can be installed using:

sudo apt-get install parted

Since I’ll want to use ntfs as file system, I’ll need to install the ntfs drivers:

sudo apt-get install ntfs-3g

Now create a new GPT partition table:

> sudo parted /dev/sda mklabel gpt
Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
Information: You may need to update /etc/fstab.

Now create a new partition with ntfs. I’ll use all of the available space, so its from 0 to 100%:

> sudo parted -a opt /dev/sda mkpart primary ntfs 0% 100%
Information: You may need to update /etc/fstab.

Now format the disk in quick format with ntfs. It will label the partition as “SynoBackups”:

> sudo mkfs.ntfs -L SynoBackups -Q /dev/sda1
Cluster size has been automatically set to 4096 bytes.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.

This label is very helpful in identifying the partition, even when it is connected to a different USB port. Using a device like sda might point to a different drive, so its better to use the label. This is one of the big advantages of using gpt in comparison to mbr.

Let’s see the label in action:

sudo lsblk --fs
NAME        FSTYPE LABEL       UUID                                 MOUNTPOINT
sda
└─sda1      ntfs   SynoBackups 4EE12D1B5321171F
mmcblk0
├─mmcblk0p1 vfat   RECOVERY    525E-19E4
├─mmcblk0p2
├─mmcblk0p5 ext4   SETTINGS    ceb0ae64-8675-406b-8eed-2244c26814c8
├─mmcblk0p6 vfat   boot        8454-E385                            /boot
├─mmcblk0p7 ext4   root0       65678398-7f53-48ec-8452-c277500fb4e8 /
├─mmcblk0p8 vfat               AC0D-3FB1
└─mmcblk0p9 ext4               ff645116-fe34-43bf-a580-b89fa963085d

Note that there’s also a more specific id, the UUID. We will use this UUID later when we configure a default mount point in /etc/fstab.

Now we’ll try to mount the new partition. Create a folder to mount the partition and mount it manually:

sudo mkdir /mnt/backups
sudo mount -o defaults /dev/sda1 /mnt/backups

Verify that the disk is mounted and try to write some stuff to it:

> df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.0G  2.7G  4.9G  36% /
devtmpfs        457M     0  457M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           462M  6.2M  455M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p6   68M   23M   46M  33% /boot
/dev/sda1       4.6T  210M  4.6T   1% /mnt/backups

> sudo lsblk --fs
NAME        FSTYPE LABEL       UUID                                 MOUNTPOINT
sda
└─sda1      ntfs   SynoBackups 4EE12D1B5321171F                     /mnt/backups
mmcblk0
├─mmcblk0p1 vfat   RECOVERY    525E-19E4
├─mmcblk0p2
├─mmcblk0p5 ext4   SETTINGS    ceb0ae64-8675-406b-8eed-2244c26814c8
├─mmcblk0p6 vfat   boot        8454-E385                            /boot
├─mmcblk0p7 ext4   root0       65678398-7f53-48ec-8452-c277500fb4e8 /
├─mmcblk0p8 vfat               AC0D-3FB1
└─mmcblk0p9 ext4               ff645116-fe34-43bf-a580-b89fa963085d

> echo "success" | sudo tee /mnt/backups/file
success
> cat /mnt/backups/file
success
> rm /mnt/backups/file
> sudo umount /mnt/backups

Now we’ll add the partition to /etc/fstab so that it can be mounted automatically:

UUID=4EE12D1B5321171F   /mnt/backups    ntfs    defaults        0       2

See that I’m now using the UUID instead of /dev/sda to mount the ntfs volume to /mnt/backups. We can test the new setting:

> sudo mount -a
> df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       8.0G  2.7G  4.9G  36% /
devtmpfs        457M     0  457M   0% /dev
tmpfs           462M     0  462M   0% /dev/shm
tmpfs           462M  6.2M  455M   2% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           462M     0  462M   0% /sys/fs/cgroup
/dev/mmcblk0p6   68M   23M   46M  33% /boot
/dev/sda1       4.6T  210M  4.6T   1% /mnt/backups

I think this is a really nice change in mounting the volumes and will create a more stable configuration, regardless which USB port you’ve used to connect your drive.

VMWare Fusion 4.1.3 does not accept Bootcamp installation

I’m currently switching from Windows 7 to Windows 8 and I wanted to make a clean install. Therefore I completely removed the Bootcamp Partition with the Bootcamp assistent of Mac OS X. However, it could not remove the partition. I’ve decided to delete the partition manually and to recreate the partition.

The Mac OS X disk utility only allows me to create exFAT or FAT partition, because NTFS is not natively supported. I’ve decided to use ExFAT and deleted my old Windows 7 installation. After installing Windows 8, I wanted to use my Bootcamp installation on Mac OS X. So I started VMWare 4.1.3 (The latest version is 5, but I’m not willing to buy the upgrade, the old version works fine under Mountain Lion.), removed the old entry for my Windows 7 Bootcamp installation and wanted to create a new one.

But this failed with several error messages, indicating that the Bootcamp disk could not be configured. After a short Google search, I’ve found the problem with the exFAT format of the Bootcamp partition: VMWare Fusion only supports NTFS formatted partitions.

 

The lessons learned from my experience:

  • If you create the Bootcamp Partition with the Mac OS X assistent, you will get a 32GB large Partition in the correct useable format.
  • If you delete yourself old Bootcamp partitions and want to reinstall, make sure you format the partition with NTFS instead of any other offered formats. Instructions for this can be seen here.
  • If you use Paragon NTFS4Mac or if you use MacFuse, you could preformat the partition with NTFS. But Windows 7 and 8 want to create a small boot partition for themself, so I would not recommend to go this path. Format the partitions from Windows setup.

 

A small update:

I was not able to use VMWare again with Bootcamp. Therefore I decided to delete the partition with the Bootcamp assistent, which crashed during this operation. I had to enter the recovery mode of Mac OS X and had to recheck and repair the complete HDD and its partition. I’ve then changed the size of the HFS+ Volume on the HDD back to its original size and created a new Bootcamp partition using the assistent:

Creation of a  Bootcamp partition on Mac OS X 10.8
Creation of a Bootcamp partition on Mac OS X 10.8

 

Next Update:

No good news to report… Windows was finally recognized correctly by VMWare, but I couldn’t add the Bootcamp installlation. The setup wanted me to reboot into Windows and reboot into Mac OS X, because it thought the Bootcamp partition was not cleanly unmounted:

Bootcamp partition is not prepared - VMWare Fusion 4.1.3
Bootcamp partition is not prepared – VMWare Fusion 4.1.3

 

So I decided to try the new VMWare Fusion 5.0.1 version and suddenly my problems were all gone… It’s sad to see, that you always need a newer software version to work correctly. Especially when Windows 8 runs just fine inside a normal VMWare VM, but not when you are using Bootcamp. My guess would be that you could install Windows 7, configure Bootcamp correctly in VMWare Fusion and then upgrade to Windows 8. But this takes awefully long, so I’ll stick to the newer Fusion version. You can test it 30 days for free and after that you have to buy it for 44,99Euro 🙁

 

Externe Festplatten und die Zusammenarbeit von Win & Mac

Ich habe mich damit ja schon abgefunden gehabt. Mac OS liest zwar das NTFS Dateisystem von Windows 2000/XP/2003 aber beschreiben kann es das nicht. Angeblich soll sich dies ja mit Leopard sich ändern.

In der Zwischenzeit blieben mir nur wenige Alternativen:

  • Die NTFS Partition löschen und durch FAT32 oder HFS ersetzen, dann kann der Mac auch wieder drauf schreiben. Jedoch kann man bei FAT32 keine Dateien über 4GB Größe anlegen und HFS kann nur der Mac wieder beschreiben.
  • Lese/Schreibzugriff über einen Windows Rechner und eine Netzwerkfreigabe/FTP machen, setzt aber einen laufenden Windows Rechner vorraus. Nicht praktikabel
  • Die Firewire/USB Platte an Parallels und der installierten BootCamp installation weiterreichen und dort beschreiben. Problem bei mir: Parallels bekommt keinen Exklusiven Zugriff weil das Mac OS da dauernd was mit machen will, auch wenn es unmountet ist

Folglich habe ich lange überlegt und habe dann mich für eine Umpartitionierung entschieden. Von den 250GB habe ich 200GB mit HFS formatiert für den Mac, und die restlichen 50GB mit NTFS falls ich mal größere Dateien unter Windows zu bearbeiten habe.

Allerdings zeigten sich hier dann auch schon wieder die Tücken im Detail… Ich habe mir gedacht, ich mache erst eine HFS Partition auf dem Mac und lasse 50GB frei, die ich dann in Windows bequem mit NTFS Formatieren kann… Tja schade das Windows meinte “Dieser Datenträger ist nicht dynamisch und nicht initialisiert, wollen Sie ihn initialisieren?”. Wie sich herausstellte, lag es an der unterschiedlichen Partitionierungsschemen die Mac und Windows unterstützen. Windows Rechner nutzen den MBR, während Apple Rechner noch mindestens zwei weitere Verfahren unterstützen. Dies wusste ich nicht, also habe ich meine HFS Partition abreißen müssen und habe dann erst die NTFS Partition erstellt unter Windows und habe dann auf dem verbleibenden Platz die HFS erstellen können. Das ging aber jetzt zum Glück wunderbar.

Dennoch: ich warte dringend auf den NTFS Schreibsupport. Die vorhanden Freeware Alternativen mit FUSE und MACFUSE sollen zwar gut laufen aber so richtig trauen tue ich dem dann auch nicht. Gerade bin ich beim Recherchieren auf eine Anleitung gestoßen, die es wohl doch ermöglichen soll 😉 Experimentierfreudige bitte vor und melden ^^