how to format hard disk partition using it's superblock using C program
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
how to format hard disk partition using it's superblock using C program
Hi here is my problem,
I want to format the hard disk partition using filesystem independent method which will look into superblock of the partition and format the contents of the disk and also edit the superblock making all the erased blocks as the free blocks in bitmap.I want to do all these using C program is there any example code showing how to achieve this.
Thanks in advance.
Last time I checked, formatting a drive _was_ file system dependent. There is no such thing as a generic formatter. Although the different filesystems use the same concepts of superblocks, inodes, their implementation varies thus a generic program would not be adivsed.
Do you want something that will just delete from the disk in an file system independent way? One already exists, it's called dd. No matter what you do, dd, or any other wipe utility, you'll be forced to use a 'filesystem' formatter before you can use the disk again, unless you have a program that will access raw partitions.
Thanks for the suggestions I'll follow the filesystem dependent format commands in linux.
one more query can I format the NTFS partition from linux?R there any commands like mkfs.ntfs? please help.
Thanks once again for the suggestions.
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705
Rep:
There is no robust r/w support for NTFS in linux (yet) and certainly no formatting support. If you write it, you'll be a hero, unless you toast peoples' filesystems. In that case, you will be the opposite of a hero
Thanks for reply regarding NTFS support for linux I just wanted to confirm it.
Regarding using system(command); in C I know how to use it but how to catch errors when I execute a command using system it just returns whether the command was able to execute or not isn't it? if I want to catch errors occured during execution of that command then how to do that?
Thanks for NTFS clarifications.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.