Re: Command line for creating partitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris thanks for this detailed reply!

On 08/07/2014 04:14 PM, Chris Murphy wrote:
On Aug 7, 2014, at 12:45 PM, Robert Moskowitz <rgm@xxxxxxxxxxxxxxx> wrote:

I am working now more on handcrafting my SD cards for arm testing. Gparted did not do a good job, allowing me to make parititions not on 'cylinder boundaries'.
FWIW cylinder boundaries are legacy and irrelevant, for either SSDs (including SD cards) or HDDs. You have to go back two epochs to get to CHS being relevant. Everything is LBA these days. The boundary you want is simply 2048 for 512 byte (logical) sectors, which is a 1MB boundary. That's the easiest and works well for everything, you don't have to think about it any further. Any recent parted, fdisk, and gdisk do this.

It was fdisk that was complaining.

#fdisk -l

Disk /dev/nand: 3984 MB, 3984588800 bytes
255 heads, 63 sectors/track, 484 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xffffffff


Disk /dev/mmcblk0: 15.6 GB, 15560867840 bytes
4 heads, 16 sectors/track, 474880 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cd80a

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1              33       16416      524288   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/mmcblk0p2 16417 49184 1048576 82 Linux swap / Solaris
Partition 2 does not end on cylinder boundary.
/dev/mmcblk0p3           49185      465184    13312000   83  Linux
Partition 3 does not end on cylinder boundary.



  And the labels it created were not recognized when I mounted the drive.  I had to use the disk utility to fix the labels.
Not recognized? That's vague. What does happen? The volume label appears garbled, or is blank? What is "disk utility"? There's "Disks" a.k.a. gnome-disks.

With Gparted, I removed the original MSDOS partition on the created and formated the above partitions labeling them uboot and rootfs. I removed the drive and remounted it (this wsa on my F20 notebook) and they were mounted under /run/media/rgm/ with their UUIDs, not these labels. I started up Gnome-disk-utility and sure enough, no labels, so unmounted, I labeled the partitions, and they remounted as I wanted them to be named.


Is the SD card being GPT partitioned or MBR partitioned? GPT partitions support partition names, MBR partitioning doesn't. So maybe there's a weird conflict somewhere between volume labels (a filesystem name), and partition names (a GPT only thing).


  Anyway, to script it and to put this up on some wikis, I really need to do this by command line.

So I have looked at both fdisk and parted.  Neither are for 'simple' command lines.  Fdisk takes me back to my DOS days (wonder where MS got it from?).

So first I want a command that will delete all partitions on /dev/sdb
fdisk and gdisk have only interactive modes. parted has both command line and interactive modes, it sounds like you're only familiar with the interactive mode. But I'm not sure if it accepts MB units in command line mode; it does in interactive mode. Possibly cfdisk or cgdisk will offer what you want.

I will look more at parted.



Of course, I understand how many MB I want each, but I am suppose to (or so from the warnings that 'fdisk -l' provided) maintain boundaries.
If you specify all partition start and end values in MB, or in sectors that are 2048 divisible, it's fine. You can even get away with much less, the only time alignment really matters is 4096 sector HDD's, so that's an 8 sector or 4KB alignment. It's just that 1MB or 1GB units is ultimately all we care about for partition sizes, and they happen to align.

Further down the road, I will be setting this up on a HD or SSD, so that will be a concern before I can say I am 'done'.


--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux