:: Re: [DNG] fdisk SD card partitionin…
Inizio della pagina
Delete this message
Reply to this message
Autore: Fred
Data:  
To: dng
Oggetto: Re: [DNG] fdisk SD card partitioning question
On 6/12/22 09:18, Antony Stone wrote:
> On Sunday 12 June 2022 at 17:11:45, Fred wrote:
>
>> Hello,
>>
>> I have some directories I want to back up to an SD card while preserving
>> the permissions. I have tried to repartition a 64GB card and write an
>> ext4 filesystem.
>
> What is the existing partition table?
>
> Out of interest, since this is ext4 and therefore Linux (not Windows), why
> partiton at all? Why not just "mkfs.ext4 /dev/sdX"?
>
>> fdisk says the card has 124702720 sectors and has 59.5GB available.
>> However it will not make a partition over 27.5GB. Why and what to do?
>
> What's the output of "fdisk -l /dev/sdX"?
>
> Have you tried wiping the partition table and creating a new one?
>
>     dd if=/dev/zero of=/dev/sdX bs=10M count=10

>
> Then use fdisk as usual - it will prompt you to create a new table.
>
>
> Antony.
>

Hi,
As supplied the SD cards are intended to work with Windows. Under Linux
only root can write to them and the ownership can not be changed. I
want preserve permissions of data written to the card.

root@aragog:# /sbin/fdisk -l /dev/sdb
Disk /dev/sdb: 27.48 GiB, 29504831488 bytes, 57626624 sectors
Disk model: Card-Reader
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device     Boot Start       End   Sectors  Size Id Type
/dev/sdb1       32768 124735487 124702720 59.5G  7 HPFS/NTFS/exFAT


I don't know why the size is reported differently in two places. It is
a 64GB card.

I tried your dd command line and things have gone downhill as the 64GB
card is now only 27.4GB.

root@aragog:# /sbin/fdisk -l /dev/sdb
Disk /dev/sdb: 27.48 GiB, 29504831488 bytes, 57626624 sectors
Disk model: Card-Reader
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


I tried fdisk again with the same result.

root@aragog:# /sbin/fdisk /dev/sdb
Command (m for help): n
Partition type
    p   primary (0 primary, 0 extended, 4 free)
    e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-57626623, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-57626623, default 
57626623):


Created a new partition 1 of type 'Linux' and of size 27.5 GiB.

Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n
Partition type
    p   primary (0 primary, 0 extended, 4 free)
    e   extended (container for logical partitions)
Select (default p): e
Partition number (1-4, default 1): 1
First sector (2048-57626623, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-57626623, default 
57626623):


Created a new partition 1 of type 'Extended' and of size 27.5 GiB.


Any ideas?

Best regards,
Fred