Sample Header Ad - 728x90

Parted Error: The location XXMB is outside of the device /dev/xxx

2 votes
1 answer
516 views
I'm trying to manually create a distro on my SD card, starting with creating partitions and it's failing...
$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    1 119.4G  0 disk 
vda    254:0    0    12G  0 disk 
├─vda1 254:1    0   300M  0 part /boot
└─vda2 254:2    0  11.7G  0 part /
$ sudo dd if=/dev/zero of=/dev/sda bs=1M count=32
32+0 records in
32+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.0289816 s, 1.2 GB/s
$ sudo parted -s /dev/sda mklabel gpt
$ sudo parted -s /dev/sda mkpart fat32 32MB 512MB
Error: The location 512MB is outside of the device /dev/sda.
What could be the potential cause for this?
$ sudo parted /dev/sda unit mib print free
Model:  (file)
Disk /dev/sda: 32.0MiB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start    End      Size     File system  Name  Flags
        0.02MiB  32.0MiB  32.0MiB  Free Space
And for whatever reason, there now is a sda1 partition appearing when entering lsblk. I think it happens as soon as the label is being created.
$ lsblk
...
sda      8:0    1 119.4G  0 disk 
└─sda1   8:1    1 119.4G  0 part 
...
[edit] Perhaps I should have mentioned that I was doing all this in a VM. For whatever reason fdisk in the VM would find a ghost partition the moment I add a label. It should have been deleted, but there it is. I was able to delete the partition by disabling the SD card from the VM, reinsert it and start gdisk on my host. Unfortunately, the issue remains, now without the ghost partitions.
Asked by Folaht (1156 rep)
Dec 30, 2024, 04:12 PM
Last activity: Jan 4, 2025, 12:01 PM