Automating partitioning setup of /dev/sda on /dev/sdc
Objective: To recreate the partitioning setup of /dev/sda on /dev/sdc
How would I parse the below information and initialize variables
(an array?) that can be used to build sgdisk commands in a script, regardless of the number of partitions?
Something along the lines of:
for each partition listed in text produced by an sgdisk - i command.
I am thinking that I can save this text to a file in the backup process and then use it in the restoration process...
Thank you vey much in advance for any time and effort expended in answering my
question!
Last edited by RogerBaran; 05-21-2015 at 03:52 PM..
Reason: clarification
As this is crucial (and possibly dangerous, e.g. disk structures differ), and as it's a one off exercise, I'd do it manually and not by script/automated parsing.
I agree. This is for a home project on expendable resources. This is part of a Crashed Disk Recovery project that I am working on. Lots of hard disks here to experiment with! 😄
---------- Post updated at 12:15 PM ---------- Previous update was at 12:13 PM ----------
Can you help with the scripting?
Last edited by RogerBaran; 05-21-2015 at 03:50 PM..
Reason: Clarity
It would take a great deal of trial and error to get what you want. I'm not sure sgdisk -p is printing all the info you really need, and there's often more to it than just plugging in the right numbers.
I take it your goal is to reorganize partitions into some known-good configuration? have you considered dd?
What exactly is your "crashed disk recovery project"?
Yes DD will not work because the cylinders value on the other drive is not the same as the originating drive. so my only approach would be to recreate the partitions manually that match the original drive, format them out, and then replace the file structure in each one of those partitions. In this case it's a single partition for EFI, one for Boot and a LUKS partition... Any other method seems to result in a corrupted partition table.
sgdisk is providing just enough info to recreate the partition structure. I'm just not sure how to pull that info and what "for" loops I would need.
Yes DD will not work because the cylinders value on the other drive is not the same as the originating drive.
Just how old are these hard drives? "cylinders" is completely meaningless on any drive newer than 1996, and a partition table with primary partition starting at sector 2048 looks pretty modern too.
Having not seen what you were doing, I can't say why your other methods resulted in a corrupted partition table.
The first time I used the DD to copy the first 2048 sectors off the drive and then I used dd to also copy both of the other partitions. At that point gdisk would complain that I had a corrupt GPT table and that my partition was over running X number of sectors into the next partition. I read somewhere that that's because the way that the drive handles writing the information to the disc is based upon the geometry of the cylinders heads and sectors ...
---------- Post updated at 02:22 PM ---------- Previous update was at 02:19 PM ----------
That's why I decided trying to copy the partition information over to another drive was not a good idea and that what I should actually do is just go ahead and zap a disc get a brand new GPT on there and then format it out one partition at a time and then copy the data into it
Hi,
In our HP-UX B.11.11. I could not find dev/urandom and dev/random
Are all pseudo-devices implemented as device drivers, or in need to run /configure some package to install the package to have dev/urandom.
Please help (4 Replies)
Hello AIXians,
I can't boot my AIX, it hangs and stops at the code error: 0518
After searching google, I knew the problem is due to problems in File Systems.
So the solution is booting from any bootable media, then run these commands in maintenance mode:
#fsck -y /dev/hd4
#fsck -y... (3 Replies)
Hi,
How can i check that i am using RAW devices for storage in my AIX machine...
Also after adding a LUN from storage to a aix host, when i check /dev in the host, i can see both rhdisk and hdisk with same number
eg:
dcback1(root):/dev>ls -lrt | grep disk12
crw------- 1 root ... (4 Replies)
So, we removed a LUN from the SAN and the system is refusing to remove the references to it in the /dev folder. I've done the following:
devfsadm -Cv
powermt -q
luxadm -e offline <drive path>
luxadm probe
All those commands failed to remove the path. The drive stills shows up as <drive... (13 Replies)
Hello,
Ive got an HP LaserJet 2100 / parallel interface.
I had some troubles getting going due to non-working cups drivers. Updated cups and also used a .ppd.gz file from something HP provided. found the files here...
www.linuxprinting.org/show_printer.cgi?recnum=HP-LaserJet_2100
Anyways.... (1 Reply)
Hello,
i am using finch (unix commandline instant messaging client using libgnt) which is running connected to /dev/pts/1
Now I would like to "remote control" the program by sending the key combinations normally typed on the keyboard from a programm in another shell. So I tried:... (0 Replies)
Hi, Anyone can help
My solaris 8 system has the following
/dev/null , /dev/tty and /dev/console
All permission are lrwxrwxrwx
Can this be change to a non-world write ??
any impact ?? (12 Replies)
Please help urgently.
I need to setup up some sort of service on a solaris server on a port.
I dont need it do anything special, anything that is sent to this port from an external server should be dump to /dev/null or a flat file..
Can you help urgently? (1 Reply)