LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 03-28-2003, 05:54 AM   #1
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Rep: Reputation: 30
Question automated fdisk problem -- advice needed


I have a boot cd that has a small linux distro on it and i am trying to alter the boot up script (rcS) so that it automagically partitions a HDD.

I was thinking of getting the fdisk list and then diffing it with the table that i want like so:

fdisk -l /dev/hda > file.txt
diff file.txt intended_partition_table.txt
if null then no need to partition

however thats going to be a problem then as the partition table set up that i want to load up to partition the disk looks like this:

# partition table of /dev/hdc
unit: sectors

/dev/hdc1 : start= 63, size= 523089, Id=83
/dev/hdc2 : start= 523152, size= 1049328, Id=82
/dev/hdc3 : start= 1572480

as you can see /dev/hdc3 is supposed to start at 1572480 and by not putting a value for size it will use the rest of the harddrive space, that way i can put a hardrive of any size in and it will always be able to put this configuration in.

this is a list that i took off of the HDD as it currently stands:

Disk /dev/hdc: 29785 cylinders, 16 heads, 63 sectors/track
Units = cylinders of 516096 bytes, blocks of 1024 bytes, counting from 0

Device Boot Start End #cyls #blocks Id System
/dev/hdc1 0+ 518 519- 261544+ 83 Linux
/dev/hdc2 519 1559 1041 524664 82 Linux swap
/dev/hdc3 0 0 0 0 0 Empty
/dev/hdc4 0 - 0 0 0 Empty

so you can see no matter what i put in the doctored patition file will always produce a difference.

Anyone got any ideas? I did think that i shouldnt need to do the check, because repartitioning a disk with the same partition table that is already on the HDD wont cause any data loss.
 
Old 03-31-2003, 01:47 AM   #2
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Original Poster
Rep: Reputation: 30
anyone at all?
 
Old 03-31-2003, 02:22 AM   #3
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
I think you should do the check no matter what. You don't want to go repartitioning the disk everytime.
I'm not sure if I understand exactly what you are trying to accomplish. But if you want the output of fdisk -l /dev/hdc to be in the same format as your reference file. You will have to parse the output and then change the format which can then be copied to a temp file or directly compared to the reference file.

I don't know how familiar you are with any types of scripting languages. But perl would probably be a good candidate for that.
 
Old 03-31-2003, 02:54 AM   #4
Frustin
Member
 
Registered: May 2002
Location: Essex, UK
Distribution: Debian, Redhat, AIX 5L
Posts: 512

Original Poster
Rep: Reputation: 30
i am creating a setup cdrom disk. put it in the drive turn on computer and then when it says power off remove the disk and your linux is installed onto the harddrive.

Thing is i figure if i can tell it not to repartition every time then it can also be used as a restore disk incase the files on the harddrive get stuffed in some way, hence why i would like to do the check.
 
  


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
weird fdisk problem (Fdisk unable to see winxp partitions) khidot Slackware - Installation 5 04-07-2007 09:26 PM
advice needed bshearer *BSD 2 04-18-2005 12:19 PM
Fdisk Expert !! Badly needed mickeyboa Fedora 1 07-18-2004 08:52 PM
advice needed ezra143 Linux - Laptop and Netbook 1 08-13-2003 02:44 PM
Slackware - Advice Needed Rjf90 Slackware 7 12-15-2002 09:06 PM


All times are GMT -5. The time now is 10:21 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration