[SOLVED] fdisk and parted give different output (which one should trust?)
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
It works as a bootable thumbdrive to install Debian 9.
Now, on a CentOS 7 terminal,
I found this:
Quote:
[root@centos73-asus ~]# fdisk /dev/sdc
Welcome to fdisk (util-linux 2.23.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): print
Disk /dev/sdc: 15.7 GB, 15669919744 bytes, 30605312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x13156673
Device Boot Start End Blocks Id System
/dev/sdc1 * 0 669695 334848 0 Empty
/dev/sdc2 3996 4827 416 ef EFI (FAT-12/16/32)
Command (m for help): quit
But
Quote:
[root@centos73-asus ~]# parted /dev/sdc print
Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes.
Ignore/Cancel?
Ignore/Cancel? i
Model: SanDisk Cruzer Blade (scsi)
Disk /dev/sdc: 62.7GB
Sector size (logical/physical): 2048B/512B
Partition Table: mac
Disk Flags:
Number Start End Size File system Name Flags
1 8192B 24.6kB 16.4kB Apple
2 8184kB 9888kB 1704kB EFI
parted seems to be completely confused by the content.
That's probably a hybrid USB - open to interpretation.
For many years I avoided parted, but when gpt became the "go-to" structure for me, fdisk was useless, so I switched to parted, and got used to it eventually. With the re-write of fdisk 18 months or so ago, it now is usable again, but I tend not to use it a lot except for listing.
So, use what you're comfortable with - both are "right".
The discrepancy between fdisk and parted means that I am not ready to believe what they say about a disk
that has been subjected to a dd command. I know
the thumbdrive is 16 GB when I bought it. The deeper question is: what does dd do beyond copy blindly
from source A to destination B. How does it affect the partition table? That is the fundamental question.
I knew nothing the diff between GPT vs MBR (or msdos) until recently. Strange thing is that
I was able to manage a few laptops/desktops, each with a few OSes, some UEFI, some non-UEFI,
some grub1, and some grub2. Partitioning of the disks are always with gparted.
I guess I have always been lucky.
Anyway, I trusted gparted a lot (especially that comes with the LiveDVD of latest Linux Mint).
I hope gparted can do all what gdisk can do eventually.
"dd" does as it is requested by the user. Sometimes it is even what the user thinks they requested.
A USB thumb-drive is not a "real" disk. All of the tools work fine with "real" disks.
Be careful to define your requirements precisely - to yourself as well as to the rest of the world.
I agree with syg00. Your correct dd just copies byte for byte the contents of the file to the USB drive. However, firmware-9.9.0-amd64-netinst.iso is a hybrid ISO which is basically a CD/DVD that contains a MBR.
I believe parted is examining the filesystem which is ISO9660 but fdisk just looks at the MBR therefore your seeing a perceived discrepancy.
In another example if you use dd to create an image of a smaller drive and then copy it to a larger capacity drive, the larger drive will appear to be the same size as the smaller one because the MBR/UEFI is the same regardless of its actual "physical" size. You have to resize the partitions to use the empty space.
By deleting the MBR and recreating a new partition table and partitions you can "restore" the USB drive back to "normal".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.