Posts: 74
CGarces
Joined: 21 Apr 2013
#1
I'm trying to made an script that use FDisk to create partitions, but command like echo | fdisk not works, just hang the console and I need to kill de fdisk process.

This is the output

Code: Select all

root@antiX1:/home/Carlos# echo"p\nq\n"| fdisk /dev/sda
GNU Fdisk 1.2.4
Copyright (C) 1998 - 2006 Free Software Foundation, Inc.
This program is free software, covered by the GNU General Public License.
 
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
 
Using /dev/sda
Any idea about this error?
Posts: 74
CGarces
Joined: 21 Apr 2013
#2
Ok, I got it. I was using gnu-fdisk package (1.2.4). After remove it, fdisk use the binary that comes from util-linux.

Now the script works as expected.

Why antix comes with util-linux and gnu-fdisk?
anticapitalista
Posts: 5,955
Site Admin
Joined: 11 Sep 2007
#3
CGarces wrote:Ok, I got it. I was using gnu-fdisk package (1.2.4). After remove it, fdisk use the binary that comes from util-linux.

Now the script works as expected.

Why antix comes with util-linux and gnu-fdisk?
Because at the time of release there was an issue with fdisk in util-linux. I can't remember exactly what.
Posts: 1,308
BitJam
Joined: 31 Aug 2009
#4
I strongly suggest you use parted instead of fdisk for this kind of automation. It was designed to be automated so your scripts will be much less cryptic. If you are not certain parted will be available on your target systems then I suppose you will have to use fdisk.