On Tue, Jul 28, 2015 at 08:20:59AM -0700, Adam Baxter wrote: > Hi all, > With the following script and parted 3.2 > > #!/bin/bash > image=blank.img > dd if=/dev/zero of=$image bs=1M count=32 > sync > cat <<-EOF | parted -s $image > mklabel msdos > mkpart primary ext2 0 100% > set 1 boot on > EOF > sync > file $image > > I see different results if parted is invoked with -s or without. > > *With* -s, the call to file results in "blank.img: data" and there's no > partitions in the disk image. > *Without* -s,
Don't put the commands on separate lines when using -s: parted -s $image mklabel msdos mkpart primary ext2 0 100% set 1 boot on > > Welcome to GNU Parted! Type 'help' to view a list of commands. > (parted) mklabel msdos > (parted) mkpart primary ext2 0 100% > Warning: The resulting partition is not properly aligned for best > performance. > (parted) set 1 boot on > (parted) quit > blank.img: DOS/MBR boot sector; partition 1 : ID=0x83, active, start-CHS > (0x0,0,2), end-CHS (0x1ff,3,32), startsector 1, 65535 sectors > > Removing the quit command makes no difference. > > The script without -s will crash at least parted 2.3. That's likely fixed in newer versions. -- Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)