Bootable flash drive for both Linux and Windows: part 1
Par theYinYeti le mercredi 8 mai 2013, 15:16 - Lien permanent
This blog post starts a small series, with the aim of configuring a bootable USB flash drive for portable use on any PC. The main target is a full portable Linux OS, but I will also address the Windows OS, for those times when you have no choice ;-)
This first part is about the flash drive itself.
Here are my goals:
- There should be only one partition.
- The boot-loader should use the French keyboard, and provide access to some tools.
- The Linux OS should be hidden from Windows.
- The Windows applications should be hidden from Linux.
- All non-data folders should be hidden from both Linux and Windows, including the boot-loader folder.
- However, the folder for the Windows applications must of course be visible from Windows (but not Linux).
- No closed-source nor paid software.
First the boot-loader. A search among the boot-loaders let me see that the preferred boot-loader for my purpose is Grub2; it will accept to be installed inside a
.boot/ folder. For Grub2 to work though, I will have to make sure there are at least 63 sectors of unused space before the partition on the flash drive.
Now the filesystem. All things considered, the perfect filesystem is NTFS: it can be reliably read and written by all Linux and Windows operating systems, and it handles large partitions (my flash drive partition will contain 16GB) and many small files well (e.g.: Cygwin); besides, it allows bigger-than-4GB files, which can come handy for DVD image files (e.g.: a Linux distribution you just downloaded).
Unfortunately, I tried NTFS already and I eventually had to abandon it. While it works great, its ACL come in the way: you regularly cannot access files that were created on a given computer, when you are on a different computer. It can be painfully worked around by changing ownership and then access rights, provided you are an administrator on this computer. NTFS is thus better but reserved for those who will use the flash drive on a select few computers.
Conclusion: the flash drive will be ready after a single FAT32 partition is created on the whole flash drive, starting at least 63 sectors from the start of the drive.
For the partitioning, use whatever tools you like. I usually use fdisk or gparted. When creating the FAT32 partition, be sure to select a label! Let us say the label is “
FLASH” for the remainder of this series, for example (adapt for you actual flash drive path, of course; also, be advised that the following command will wipe the given partition):
mkfs.vfat -n FLASH /dev/sdb1
Next blog post will deal with the installation of Grub2.
- 2013-09-18 — Some clarifications.