Adding a partition without losing data

Tips and tricks on HDDRIVER/Tipps und Tricks zu HDDRIVER
uweseimet
Site Admin
Posts: 408
Joined: 10 Jan 2010, 15:39

Adding a partition without losing data

Post by uweseimet »

If some preconditions are met, you can add a partition to an existing drive/memory card without losing data:

1. There must be unused space at the end of the drive/memory card, after the space allocated by existing partitions.
2. You want to add a partition as the last partition on this drive, and not between other partitions or at the beginning.
3. The drive must have a GPT partition scheme.
4. You have the means to run fdisk (e.g. under MiNT) or a similar tool that can handle GPT partitions. This can also be a tool on a different platform, provided that you can connect your drive/memory card to this platform.
5. If you need to run a tool on a different platform the drive data must not be byte-swapped.

If these conditions are met, you can add a partition like this:

1. Launch fdisk or a different tool with similar capabilities.
2. Create a new partition on the drive and assign the empty space to it. With fdisk use the "n" command and accept the default settings for the partition.
3. By default fdisk creates a Linux partition. Change the GPT partition type to "Atari TOS basic data". With fdisk you can use the "t" command for this. Since version 2.41 fdisk knows the GPT partition types for TOS, so that you do not have to enter the GUID manually but can select the type from a list. You can also use HDDRUTIL to edit the GPT partition type.
4. Now you have an additional partition but there is no filesystem on it yet. Either create a FAT16 or FAT32 filesystem with mkfs, or run HDDRUTIL. With "Edit Partitions" you can initialize the new partition with a FAT16 or FAT32 filesystem. Remember that TOS FAT16 partition have 2 sectors per cluster. Please refer to the HDDRIVER manual for details.

That's it. Read the information on the GPT scheme before you start.

In theory you can also add a partition to a drive with an MBR partitioning scheme, but this is quite complicated and error-prone. DISKUS is a tool that helps you with this, but HDDRUTIL will definitely not support it.