WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: tc-install: failed to install to NVMe storage device  (Read 214 times)

Offline y_satou70

  • Newbie
  • *
  • Posts: 47
tc-install: failed to install to NVMe storage device
« on: June 21, 2022, 11:01:52 PM »
While using tc-install.sh to install TinyCoreLinux on the host which is using NVMe as storage device, NVMe device is recognized as nvme0n1 correctly, but it looks tc-install.sh fail to install.

Here is running tc-install.sh to install TinyCoreLinux to NVMe device:

Quote
Install from [R]unning OS, from booted [C]drom, from so file, or from [N]et. (r/c/i/n): n
Enter architecture (32)bit, (64)bit or (q)uit: 64
Select Install type [F]rugal, [H]DD, [Z]ip. (f/h/z): f
Select Target for Installation of corepure64
    1. Whole Disk
    2. Partition
    Enter selection ( 1 - 2 ) or (q)uit: 1
Select disk for corepure64
    1. nvme0n1
    2. sda   On a removable device.
    Enter selection ( 1 - 2 ) or (q)uit: 1
Would you like to install a bootloader?
    Enter selection ( y, n ) or (q)uit: y
Install Extensions from this TCE/CDE Directory: [Enter]
Select Formatting Option for nvme0n1
    1. ext2
    2. ext3
    3. ext4
    4. vfat
    Enter selection ( 1 - 4 ) or (q)uit: 3
Mark nvme0n1 active bootable? y/n: y
Enter space separated boot options: [Enter]
Last chance to exit before destroying all data on nvme0n1
Continue (y/..)? y

then it considered "nvme0" as device, and "n1" as partition wrongly, directly formatting /dev/nvme0n1 - instead of creating partition on it as /dev/nvme0n1p1:

Code: [Select]
Formatting /dev/nvme0n1       <----------------- !!!
mke2fs 1.45.4 (23-Sep-2019)
Found a dos partition table in /dev/nvme0n1
1+0 records in
1+0 records out
440 bytes (440B) copied, 0.000258 seconds, 1.6MB/s
UUID="861a2016-5728-4c40-8fa6-3d1dc4249444"
Applying extlinux.
/mnt/drive/tce/boot/extlinux is device /dev/nvme0n1
Setting up corepure64 image on /mnt/nvme0n1
Toggle Active Flag on nvme0n1
Installation has completed
Press Enter key to continue.

Then the disk is messed up - after tc-install.sh completed, fdisk shows:

Code: [Select]
tc@box:~$ sudo fdisk /dev/nvme0n1

Command (m for help): p
Disk /dev/nvme0n1: 119 GB, 128035676160 bytes, 250069680 sectors
122104 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/nvme0n1p1 09 187,180,14  784,0,13    3224498923 3657370039  432871117  206G  7 HPFS/NTFS
/dev/nvme0n1p2 f4 906,235,61  262,116,59  3272020941  930513678 1953460034  931G 16 Hidden FAT16
/dev/nvme0n1p3 20 370,101,50  10,114,13            0          0          0     0 6f Unknown
/dev/nvme0n1p4    0,0,0       0,0,0         50200576  974536369  924335794  440G  0 Empty

Offline y_satou70

  • Newbie
  • *
  • Posts: 47
Re: tc-install: failed to install to NVMe storage device
« Reply #1 on: June 21, 2022, 11:09:02 PM »
Attached quick patch which I applied to handle nvme device correctly.
With this patch, tc-install.sh can handle nvme0n1 as target device (not as partition) correctly:

Code: [Select]
Writing zero's to beginning of /dev/nvme0n1   <----------------- good
Partitioning /dev/nvme0n1                           <----------------- good
Formatting /dev/nvme0n1p1                           <----------------- good
mke2fs 1.45.4 (23-Sep-2019)
1+0 records in
1+0 records out
440 bytes (440B) copied, 0.001982 seconds, 216.8KB/s
UUID="ec8341c0-55d7-4045-957e-09eaaf68f4fb"
Applying extlinux.
/mnt/drive/tce/boot/extlinux is device /dev/nvme0n1p1
Setting up corepure64 image on /mnt/nvme0n1p1
Setting up menu for Tiny Core
Remove Active Flag on /dev/nvme0n1p1
Toggle Active Flag on nvme0n1p1
Installation has completed
Press Enter key to continue.

... this correctly create nvme0n1p1 partition,

Code: [Select]
tc@box:~$ sudo fdisk /dev/nvme0n1

Command (m for help): p
Disk /dev/nvme0n1: 119 GB, 128035676160 bytes, 250069680 sectors
122104 cylinders, 64 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/nvme0n1p1 *  0,1,1       1023,63,32          32  250069679  250069648  119G 83 Linux

and confirmed installed TinyCore can boot up properly.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 666
Re: tc-install: failed to install to NVMe storage device
« Reply #2 on: June 23, 2022, 06:03:04 AM »
When I was refactoring the tc-install script, I was fully aware that it won't work with M.2 devices.
Considering that those modern PC use UEFI, I decided to leave them as they were.
TC-install only supports Legacy BIOS.

Offline y_satou70

  • Newbie
  • *
  • Posts: 47
Re: tc-install: failed to install to NVMe storage device
« Reply #3 on: June 27, 2022, 03:21:13 PM »
yeah, this is just expand support for legacy BIOS boot part :)

I think this change may not harm any other part, just expanding support - as NVMe storage becomes popular and cheaper, so if system board has socket to mount NVMe then it's reasonable choice to use it as storage device for even legacy BIOS older hardware machines (and that's reliable than eMMC/SD card usually).

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10668
Re: tc-install: failed to install to NVMe storage device
« Reply #4 on: June 27, 2022, 11:45:52 PM »
The patch is fine. tc-install being an extension, please go ahead and send an update to it.
The only barriers that can stop you are the ones you create yourself.