7

This might sound silly but I googled quite a bit on this and found a lot of different approaches.

Basically, I just added a new drive to my system and ran mkfs.ext4 on it (using it for installing games).

Since then I have been using the drive just fine (on Linux). Though whenever I boot into Windows (I don't use that drive there obviously), it would then bother me and tell me that I should choose GPT or MBR to initialize that drive.

I'm now a bit confused and wonder if I did something wrong? I thought GPT or MBR would be necessary only if I actually would have partitions on that drive. Will this cause me issues on Linux on the long run? Should I just ignore the Windows message about that or should I create a single partition on that drive using GPT/MBR instead?

Giacomo1968
  • 55,001
Noobman
  • 81

1 Answers1

11

Linux does not need a partition table, and can create a file system directly on /dev/sdb or whatever is your device. This has always been the case, and was once standard with floppies. Apparently, this is what you did with this disk.

Windows, however, requires a partition table that is created as GPT or MBR. For Windows, your disk is unformatted, so it's asking you how to format it. Doing this will of course erase all your data.

You may ignore this message of Windows. If the Windows message is too bothersome and you wish to stop it, you need to format the disk, then under Linux create a partition and format the partition as ext4. Backup your data before doing that.

Windows ignores ext4 partitions, which are anyway badly supported and usually require third-party tools to use in Windows.

For choosing between GPT and MBR, better choose GPT, as explained in this answer.

harrymc
  • 480,290
  • 1
    Windows can recognize and use disks without a partition table. Microsoft refers to these disks as supperfloppies. – 9072997 Feb 08 '24 at 22:31
  • 3
    @9072997: Correct, but then there's no partition table with a "partition type" field to tell Microsoft it's a valid but unsupported filesystem. Without that metadata, Windows can only recognize filesystems by magic, and can't tell the difference between "none present" and "unrecognized" – Ben Voigt Feb 08 '24 at 22:48
  • 11
    FWIW definitely create the partition table. Otherwise, sooner or later, you're going to accidentally hit the "Format now?" button and lose all your data. Over in the UNIX/Linux world it's also recommended that you create a single partition spanning an entire disk rather than using the disk directly without a partition table. (Some tools take great delight in writing to the first few blocks of a disk without telling you. Yes. Really.) – Chris Davies Feb 08 '24 at 23:14
  • 3
    @ChrisDavies And sane filesystems and volume managers don’t touch the first few blocks of a volume for exactly that reason. It’s still a good idea to use a partition table though, because that lets you say what the data is supposed to be (and with GPT, you can get really specific in some cases too, which is remarkably helpful at times). – Austin Hemmelgarn Feb 09 '24 at 00:08
  • 4
    Not so dumb trick. ext2 doesn't use the first sector of the disk, so write an MBR partition to it that covers the entire disk starting with cylinder 0 head 0 sector 1. Set it's type to A2h (which is about the only thing that means image) so Windows doesn't mess with it and Linux tools don't do anything interesting like detect the wrong type. Just don't mount both the sd? and the sd?1 devices at the same time due to kernel bug. – Joshua Feb 09 '24 at 00:26
  • 1
    ty that was exactly what i did. I don't have anything important on the drive so i just created a single partition now and used GPT for that. Now windows stopped bothering me and i don't risk clicking anything stupid by accident. – Noobman Feb 09 '24 at 00:30
  • @AustinHemmelgarn oh, yes absolutely. But not everything plays safe like that – Chris Davies Feb 09 '24 at 08:13
  • @ChrisDavies Windows does/did that (writing to the first few blocks). Many years ago I took the HDD out of my Amiga 1200 and put it into my Windows PC so that I could boot it in an emulator. Worked a treat, but when I put the HDD back into the A1200 I discovered that Windows had written to the first few blocks and the A1200 could no longer boot. Easily fixed, with no data loss, but annoying nonetheless. – Dermot Williams Feb 09 '24 at 11:37
  • @DermotWilliams: Windows doesn't fall into the "without telling you" category though, it asks permission before "writing a signature" – Ben Voigt Feb 09 '24 at 17:59
  • @BenVoigt not at the time it didn't! This was more than 20 years ago though, to be fair! Pretty sure I was using Win2k at the time. – Dermot Williams Feb 11 '24 at 21:37