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

Command Line Partitioning



I have a compact flash card I'm experimenting with that goes into an embedded system.  In the future I'll be working with more CF cards and I know I won't always know the size of the card ahead of time.  I'm working on a Perl program so I can put the CF card in and the program will partition it, copy over an image of Squeeze (copy files, not through dd or anything like that), make the needed changes to GRUB2 (which is a real PITA now that UUIDs are ubiquitous) and anything else that will prepare this CF card for use in the embedded system.

I have everything else worked out so it can be done in a batch mode or in a program, but I'm having trouble with partitioning.

I've been working with cfdisk, fdisk, and parted:

parted: Always leaves only 512 bytes at the start and grub-install doesn't seem to like that.  But it can be used in a batch mode.

fdisk: Doesn't seem to have a batch/script mode and I'd have to calculate sizes in megabytes from cylinder info

cfdisk: Lets me work in whatever units I like (bytes, kbytes, mbytes, and so on) but is curses based and doesn't have batch/script mode.

What I would like to do is to be able to use a partitioning program from a batch or script mode.  Parted would be good for that, but I can't seem to get it to leave more than 512 bytes at the start (cfdisk left 32k -- why?  I don't know).

Also, it seems when I get CF disks they have an MS-DOS partition table (grub kept noting that and one part of the whole process didn't seem to like that).  How can I either wipe the disk without a mess (tried zeroing it, parted wouldn't recognize it or write to it, but fdisk had no issue with that) or write a new partition table?  What type of partition table should I use?  (I'm guessing bsd, which was one of the options, but there wasn't a Linux option for types of partition tables.)


Thanks for any help on this!



Hal

Reply to: