LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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


Reply
  Search this Thread
Old 02-15-2008, 08:23 AM   #1
jjhunt
LQ Newbie
 
Registered: Mar 2007
Location: Florida
Distribution: Fedora, Knoppix, Slackware, openSuse, and SystemRescueCD
Posts: 9

Rep: Reputation: 0
Using parted in a script


I am having to re-image Windows XP Embedded machines that are formatted with fat32. This needs to be unattended, and I am having a problem with parted.

Since we don't know how big the hard drive may be on all the different controllers, the image will be just large enough to hold WinXPE, after imaging the controller, we need to expand the fat32 file system to fill the partition.

The problem is that sometimes parted comes back with an error that says "Warning: File system is reporting XXXXX clusters, not XXXXX clusters." When you use the --script flag, it simply cancels out of this warning instead of continuing with the resize. parted will do the resize correctly when you select ignore, but there in lies the problem. Does anyone know how to script this to always ignore the warning????

I've tired a here-document like this:

parted << eof


ignore
q
eof

It only works when parted does not throw the error. This error does not show up everytime, even on the same machine with the same image over and over again.

Thanks to anyone who may be able to help.
 
Old 02-16-2008, 06:10 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I don't know about your problem with parted but, I would be inclined to use scriptable fdisk ( sfdisk ) and tell it to make one partition to fill the drive. For example:
Code:
# For vfat, use C
sfdisk -D /dev/sda1 << EOF
,,C,*
EOF

# For ntfs, use 7
sfdisk -D /dev/sda1 << EOF
,,7,*
EOF

# Format the partition as vfat
/sbin/mkfs.vfat /dev/sda1

# Format the partition quickly for ntfs
/sbin/mkfs.ntfs -Q /dev/sda1 >/dev/null
 
Old 02-16-2008, 11:24 PM   #3
jjhunt
LQ Newbie
 
Registered: Mar 2007
Location: Florida
Distribution: Fedora, Knoppix, Slackware, openSuse, and SystemRescueCD
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks Homey, but the issue isn't with the hard drive partitioning, but rather the new image file system v. the partition size.

The controllers are already functioning with WinXP Embedded. But not all of the machines have the same hardware. Depending on the controller, my script will pull the correct image from the server and replace the current WinXP image with our software updates. Because we don't know how big each hard drive is in advance, the new images will be just big enough to hold the Windows image and our software. Once it is on the hard drive, the image file system will have to be re-sized to fill the partition. This is done simply by using parted to "resize" to current size. Done simply if you have someone sitting there re-imaging hundreds of machines by hand.

I think I have it working now, though. I re-ordered some things in my script and using the Here-Document I have had 100% success rate during the initial testing. Before it was 5 of 10 tries. With no real rhyme or reason why it would fail half the time.

It seems odd to me that parted was written to safely resize a partition and has a scripting option, but there is no way to ignore known warnings, and it defaults to "Cancel" in script mode. The machines and images that are formatted NTFS are no problem, because when you use ntfsresize and pass no size arguments, it forces the file system to fill the partition. Why can't parted work that simply? Oh well.

Anyways, thanks again man.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help using parted gauntalus Linux - Software 5 12-26-2004 03:40 PM
Using Parted Mathiasdm Linux - Software 7 08-23-2004 03:10 AM
Using parted jdmml Linux - Newbie 5 07-08-2004 08:39 PM
parted alaios Linux - General 5 04-29-2004 12:13 PM
Can parted do this? szf2 Linux - Newbie 1 10-24-2003 03:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration