LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Need to save partition table (https://www.linuxquestions.org/questions/linux-server-73/need-to-save-partition-table-626352/)

vedang 03-07-2008 03:00 AM

Need to save partition table
 
Hi,

I want to save partition tabale to a file and i do not want to use sfdisk command. Can i do it with fdisk or parted command?
Or is there any other way of storing partition table to a file?

DiWi 03-07-2008 03:51 AM

Do you need it for documentation purpose or just for the case ;)

Use dd for backup

Dirk

vedang 03-07-2008 06:11 AM

Need to save partition table
 
I do not need it for documentation purpose and not just for a cause.

I have made a script regarding restore and backup. My script backs up partition images and restores to a new hdd. After writing to a cd it will become a bootable cd, for which I do not want to use sfdisk and only want to use fdisk and parted commands.


Please help me.

syg00 03-07-2008 06:25 AM

Sounds like homework.
Bad strategy regardless.

Uncle_Theodore 03-07-2008 06:29 AM

dd if=/dev/hda of=<filename> bs=512 count=1

The partition table is in the last 66 bytes of the MBR.

pixellany 03-07-2008 06:44 AM

The galloping nitpicker strikes......;)

You might need /dev/sda instead of /dev/hda

The partition table is 64 bytes--the last 2 bytes is a "signature"

Do you have more than 4 partitions? If so, you need the partition boot sectors as well. You can have you script detect if there is an extended partition (by using fdisk or by parsing the primary partition table directly)

vedang 03-10-2008 05:07 AM

Reply to syg00
 
Reply for syg00 from vedang,

I am working as a Senior Linux Administrator. I am handling Software based RAID, Sendmail server, Squid Proxy and Iptables based firewall and many more things. So I can say I have knowledge in my related fields in Linux.
This forum is to help queries of freshers as well as experienced professionals. Because though you have knowledge, your knowledge will be limited to some technologies only. And when you have to work on such technology about which you are not aware of, you have to take help from some experienced professionals related to that field from such forums, that is what I did.

You should not bother if the query is for personal use or for official use or it make be a query for homework also. The cause of the query may be for personal use, for completion of a project, for exploring more knowledge , to confirm self knowledge or anything else.

If you have solution and want to share your knowledge, provide the solution for queries in the forum and if not just keep quiet.
But do not try to make comments, like what you have done on my query. Because there is no meaning for such comments.

Be careful not to make such comments onwards.


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