Why adding / removing partition must destroy the whole disk?
-
mikro
- Posts: 32
- Joined: 18 May 2010, 10:09
Why adding / removing partition must destroy the whole disk?
I have been always wondering about this. If I have a disk with 4 partitions and then 8 GB of free space and I decide to add a fifth partition, why every Atari partition software insist of destroying the whole disk's content? I get it that it's easier to implement :) but since HD Driver has such a long history and reputation... I'm pretty sure that changing the partition table "on the fly" can't be that hard?
-
uweseimet
- Site Admin
- Posts: 408
- Joined: 10 Jan 2010, 15:39
Re: Why adding / removing partition must destroy the whole disk?
This is not a simple task, depending on the existing layout and the number of partitions already present, especially if there are already more than 3 partitions. If you are interested, the AHDI release notes provide detailed information on how an AHDI compatible partition layout looks like. In particular look at how the XGM partition type works. If you find it's not that hard, just go ahead ;-).
Note that you can use disk tools like DISKUS to manually change the partition layout in some cases without losing data. parted/gparted etc. on Linux might also work if your kernel supports Atari partitions, but I have never tried that.
Note that you can use disk tools like DISKUS to manually change the partition layout in some cases without losing data. parted/gparted etc. on Linux might also work if your kernel supports Atari partitions, but I have never tried that.
-
mikro
- Posts: 32
- Joined: 18 May 2010, 10:09
Re: Why adding / removing partition must destroy the whole disk?
I'm well aware how partitions are defined, especially the extended ones, no worries. :) It's just these days it's very uncommon, be it Windows, Linux or MacOS, every major system offers a lossless way of doing it.
I could totally live only with the simplest case, i.e. adding/removing the last partition, that alone would be a huge improvement!
I could totally live only with the simplest case, i.e. adding/removing the last partition, that alone would be a huge improvement!
-
uweseimet
- Site Admin
- Posts: 408
- Joined: 10 Jan 2010, 15:39
Re: Why adding / removing partition must destroy the whole disk?
I'm afraid I do not intend to implement anything like that. Removing the last partition with a tool like DISKUS (or maybe Diamond Edge) is not a major issue if you already know how partitions are defined.
-
alanh
- Posts: 8
- Joined: 27 May 2015, 11:51
Re: Why adding / removing partition must destroy the whole disk?
I've also wanted this functionality in HDDRUTIL.
It's awkward to know what partitions you want on a disk, especially given the size of drives these days. The ability to add/remove even the last partition would be a marvelous addition.
It's awkward to know what partitions you want on a disk, especially given the size of drives these days. The ability to add/remove even the last partition would be a marvelous addition.
-
uweseimet
- Site Admin
- Posts: 408
- Joined: 10 Jan 2010, 15:39
Re: Why adding / removing partition must destroy the whole disk?
With future versions of HDDRIVER and HDDRUTIL you can address issues like this at least partially and with expert knowledge. Adding a partition when there is still unused space at the end of a medium can be done without losing any data. An important premise is that the drive is partitioned with a GPT scheme.
This is what I just tested:
1. With HDDRUTIL create a drive with 2 TOS GPT partitions, but leave several 100 MiB at the end of the drive unallocated.
2. With gparted add an additional partition, using some of the unallocated space. If this is a FAT32 partition you are already done, because the format of these partitions is the same both on DOS/Windows and TOS. There is no need to convert the DOS GPT FAT32 partition type to a the TOS GPT FAT32 type, because DOS and TOS partitions can coexist in a GPT scheme without any work-arounds. For ext2 it should be similar (not tested).
The next steps are only required with a FAT16 partition, because the boot sector data created by gparted are not valid for TOS. One can either use tools like parted and mkfs, or do this on the Atari:
3. a) With HDDRUTIL ("Edit partitions") change the GUID of the new GPT DOS/Windows partition to the GUID of a regular TOS partition.
3. b) With "Edit partitions" initialize this TOS partition with valid data for the sector size and number of sectors per cluster.
You can also use gparted to remove a partition. Other tools, e.g. the macOS disk utility, may also work for adding a partition, as long as the respective tool knows the target partition type/filesystem. For removing a partition any tool should work, regardless of the platform.
This is what I just tested:
1. With HDDRUTIL create a drive with 2 TOS GPT partitions, but leave several 100 MiB at the end of the drive unallocated.
2. With gparted add an additional partition, using some of the unallocated space. If this is a FAT32 partition you are already done, because the format of these partitions is the same both on DOS/Windows and TOS. There is no need to convert the DOS GPT FAT32 partition type to a the TOS GPT FAT32 type, because DOS and TOS partitions can coexist in a GPT scheme without any work-arounds. For ext2 it should be similar (not tested).
The next steps are only required with a FAT16 partition, because the boot sector data created by gparted are not valid for TOS. One can either use tools like parted and mkfs, or do this on the Atari:
3. a) With HDDRUTIL ("Edit partitions") change the GUID of the new GPT DOS/Windows partition to the GUID of a regular TOS partition.
3. b) With "Edit partitions" initialize this TOS partition with valid data for the sector size and number of sectors per cluster.
You can also use gparted to remove a partition. Other tools, e.g. the macOS disk utility, may also work for adding a partition, as long as the respective tool knows the target partition type/filesystem. For removing a partition any tool should work, regardless of the platform.
-
mikro
- Posts: 32
- Joined: 18 May 2010, 10:09
Re: Why adding / removing partition must destroy the whole disk?
This is surely useful info, thanks for that.
-
uweseimet
- Site Admin
- Posts: 408
- Joined: 10 Jan 2010, 15:39
Re: Why adding / removing partition must destroy the whole disk?
There are also other interesting setups, which I have not yet tested: DOS/Windows compatible media that do not have any FAT16 partitions should be fully compatible with TOS out of the box, because only FAT16 partitions are not compatible between TOS and DOS/Windows. Everything else is compatible, as long as there is a GPT scheme. With an MBR there is a conflict with the root sector format, but with a GPT there is not.
So a DOS/Windows/Linux compatible drive with only FAT32 and ext2 partitions, for instance, should work with the Atari (and a future HDDRIVER) without any work-arounds.
So a DOS/Windows/Linux compatible drive with only FAT32 and ext2 partitions, for instance, should work with the Atari (and a future HDDRIVER) without any work-arounds.
-
francois
- Posts: 3
- Joined: 05 Sep 2024, 18:08
Re: Why adding / removing partition must destroy the whole disk?
+1 for having a simple and user friendly way to add and remove GPT partitions inside of HDDRUTIL (even if it's just the last partition).
I also find it super frustrating to define all partitions once and for all on a new drive when all I want is to set up my C: partitions and think about exact sizes I need for other partitions later.
Using only FAT32 would be nice but I think it's not supported by TOS 4.04. I also believe I read it's recommended to use FAT16 for better performance of smaller partitions where FAT32 is not needed.
I also find it super frustrating to define all partitions once and for all on a new drive when all I want is to set up my C: partitions and think about exact sizes I need for other partitions later.
Using only FAT32 would be nice but I think it's not supported by TOS 4.04. I also believe I read it's recommended to use FAT16 for better performance of smaller partitions where FAT32 is not needed.