Programming :: Filesystem Formatting In C?
Apr 5, 2011
I'd like to know if it's possible in my program (C/C++) to create a filesystem on a partition, maybe with advanced options too. I don't want to call the shell and execute the usual commands to do that, so I wonder if there are some native Linux syscalls or external libraries to do that.
View 6 Replies
ADVERTISEMENT
May 19, 2011
I'm trying to format an external hard disk under Ubuntu 10.04. All starts well, but eventually I get the message:
Error formatting volume
Error creating file system: helper exited with exit code 1:
Error calling fsync(2) on /dev/sdb1: Input/output error
View 1 Replies
View Related
Jul 19, 2010
I'm trying to partition/format a new external hard disk for backup and have run into a snag that now prevents my computer from booting. In the description below of what happened please bear with me as I do my best to remember the commands and screen output (which for obvious reasons I don't have in front of me).As root.The disk was subsequently writable. However, I then realized that the default start and end cylinders had resulted in a very small partition apparently occupying some free cyclinders in the beginning of the disk.
So next I ran fdisk again, deleting the sdc4 I had just created and creating a new one instead, this time using the cylinders at the end of the disk. When I exited fdisk I got a message something like that the new tables can only be read upon a subsequent reboot. I ran mkfs again, but not e2label. Indeed using /sbin/fdisk -l, sdc4 still had the small size as defined initially. So I rebooted.
Now when it comes up I get something like "checking filesystems. fchk.ext3: can't resolve 'LABEL=/media/LaCie2TB1'" and am prompted to login as root to correct. I tried to simply delete sdc4 again but that didn't help. I also tried to edit /etc/fstab (using vi, which I don't know at all) but it kept telling me that this is a read only file, even though permissions are rw for root.Can anyone out there help me so that (1) I can boot into my computer, and (2) I can correctly partition and format the hard drive??
View 2 Replies
View Related
Sep 1, 2011
I had Ubuntu and Kubuntu installed to dual-boot using the GRUB loader installed by Kubuntu. I mistakenly formatted the Kununtu partition to NTFS in an attempt to install Windows XP in its place without updating grub to pull the files from my Ubuntu partition.
Now, when I go to boot the computer, I receive a the "error: unknown filesystem" and the grub rescue prompts for commands. I've attempted to boot from both a Ubuntu Live CD and a Secured Ubuntu CD with boot repair built into it, but receive the same message both times. I know this isn't an issue with my boot order (I've changed that), and my computer will boot into a Windows XP setup disc (which will not proceed for a different reason)
View 1 Replies
View Related
Jul 10, 2011
I copied and tested a piece of simple formatting a datetime string code from book, c++ cookbook, page 201, Chapter5 section2, Example5-4. but it wont compile in my g++ 4.5.2(on ubuntu 10.04, kernel2.6.35-25)
Example 5-4 formatting a datetime string
Using namespace std;
View 1 Replies
View Related
Apr 13, 2011
I wrote an expect script that tests user authentication against a RADIUS server. The username is an email address, including an @ sign. I recently wrote an HTML/PHP front end to allow others to input username/password into a form and then see the results when they hit submit. Expect code that takes two args username, and password
Code:
expect "#"
send "test aaa group radius [lindex $argv 0] [lindex $argv 1] new-code
"expect "#"
[code]....
Every works as it's supposed to, except for the output of the script. When it displays on the webpage, it's segmented weirdly with all throughout. What I've found is when I remove the @ sign in the username input, it fixes it. Is there any part of HTML or PHP that treats the @ as a special character? 1 more thing is that I have another HTML/PHP/EXP script that works fine with the @.
View 2 Replies
View Related
Jun 30, 2010
I need to extract som text from a text file. The text is a test log with system info at the top and results further down. What I need is to add different tags with formatting before and after each line. I have prepared a template with html formatting, but the number of lines in the test log may be different from case to case, so I need to be able to add formatting tags by need. Can this be done using bash script, sed, awk, head, tail... ?
View 4 Replies
View Related
Oct 11, 2010
I need a script which can format the below text file which contains comments
Code:
Code:
Output should be:
Code:
Code:
Script should compare the column name and paste the output in above said manner.
View 13 Replies
View Related
Jul 23, 2010
I'm writing a script that takes the date attribute of a file when it was created and appending it to the name. I'm pretty close to what I need, but the date appears in yyyy-mm-dd format and I want it to read mm-dd-yyyy. What I have done so far is something like
for ((i=1;i<=50;i++));
do fdate=`stat -c %y Video Snapshot $i.png|awk {'print$1'}`;
newname=Personname-$fdate-$i.png;
mv Video Snapshot $i.png $newname;
done
This works decently but the date comes out in the yyyy-mm-dd format. How do I change it?
View 10 Replies
View Related
Jan 9, 2010
I have a script that presents download link, but it shows download links in one line.How do I get it to show each link in its own line?
my $message_text =
join "
",
[code]...
View 9 Replies
View Related
May 18, 2011
I am very new to linux, and I have a question regarding the filesystem check (fsck). The power recently went out and when I tried to restart linux the following error appears:
*/dev/sda1 contains file system w/errors, check forced it then goes on to say..
*An error occured during the file system check. Dropping you to a shell; the system will reboot when you leave the shell. Give root password for maintenance (or type Control-D to continue) I wasn't sure what to do, but checked some other online forums and they suggested running fsck manually - so I typed in the root password - and used the command, "fsck -A -V ; echo == $? ==" it then gave the following message
*WARNING!!! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage
*Would you like to continue (y/n)
Again, I wasn't sure what to do so i just checked no. I then manually turned off the computer and was prompted at the beginning to press Alt-3. I was brought to another screen and it informed me one of the drives was degraded and suggested rebuilding the array. I tried doing this, but it still brings me back to the original error of, "/dev/sda1 contains file system w/errors, check forced," and the process continues.
Also, when I tried to rebuild the array, I didn't backup any of the data on our home directory before doing this (which was probably a big mistake). After being prompted to type the root password, I was able to give the ls command and look at all the directories...the home directory where our data was stored was empty and I am afraid I may have lost some information. Is there a possibility that data was lost when I was trying to rebuild using the old drives?
View 2 Replies
View Related
Feb 9, 2011
I want to display the contents of a particular log file (simple text file, I mean in Linux). But there is a problem: The contents need to be organized in a fixed format. Have a look at this log file:
sampleLog.txt
Code:
User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!
[code]....
So, while displaying the contents of above file on a web page, I want to format the field names found in the log file: User Name:, Reported Problems Description:, and Remarks:. These fields may contain a variable length of text and no specific line number is assumed for them to appear on.
The desired output should look like this:
User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!
[code]....
Well, what I am trying to do may sound wierd to some of you. The filed "Reported Problems Description:" can possible contain text which embeds colon (.
View 15 Replies
View Related
Jul 22, 2010
is there a way to make the /proc filesystem writeable? With aufs or unionfs i can't join the /proc filesystem with a writable directory directly. But i think it should work by using one of this file systems.If i try to join two dirs write-proc and virtual-proc Code: mount -v -t aufs -o dirs=/tmp/write-proc/:/tmp/virtual-proc/ none /tmp/joined-proc/ and afterwards make a bind mount /proc to virtual-proc Code: mount --bind /proc /tmp/virtual-proc/ i can't see any change in /tmp/joined-proc.
View 2 Replies
View Related
Dec 6, 2010
I have a requirement, to read the complete proc filesystem from the linux pc.. Does linux provide some functions to read the proc filesystem means the directories and files present in the filesystem.. in short I want to create a treeview of proc filesystem. and if a user selects the file in the proc.. I should show the contents in the respective file. So I want some library or functions to read the proc filesystem..
View 1 Replies
View Related
Jan 7, 2011
The declaration for directory record length in ext2 filesystem is as follows:
Code:
#define EXT2_NAME_LEN 255
struct ext2_dir_entry_2 {
__u32 inode; /* Inode number */
__u16 rec_len; /* Directory entry length */
__u8 name_len; /* Name length */
__u8 file_type;
char name[EXT2_NAME_LEN]; /* File name */
};
Some say because the record is not in a fixed length so rec_len is the real record length. Why is the length of the array `name' not fixed? I thought C arrays like this should be fixed length. C99 has variable-length arrays, does this structure count on C99?
View 7 Replies
View Related
Mar 27, 2010
When I try to boot to OpenSUSE I get the following error during boot-up: unknown filesystem type 'reiserfs' could not mount root filesystem - exiting to /bin/sh$
This only started happening quite recently - before this I could boot to Linux quite happily.
View 6 Replies
View Related
Mar 11, 2011
I am trying to mount a file image, like this
mount -o loop /tmp/apps.img /media/apps
But I get the following:
mount: you must specify the filesystem type
I try ext3:
mount -o loop /tmp/apps.img /media/apps -t ext3
dmesg says:
error: can't find ext3 filesystem on dev loop6.
I've also tried ext2, vfat etc. How can I detect the filesystem type of apps.img?
View 2 Replies
View Related
Jul 9, 2010
I have a following problem: Recently my drive with Ubuntu 9.4 has mysteriously stopped working, i.e. when I switch the computer on it informs me that GRUB didn't find the filesystem. Well, I suppose it happens.
First, I though it was due to the drive dying, but I popped it in an external enclosure and HDTune told me the drive was fine. Wanting to recover the files on the drive before reinstalling I first tried to mount it in said external enclosure under Windows (I have Win Ext2 driver installed which used to work just fine). This time, however, drive gets assigned a letter but upon opening it Windows popped up an error saying that the drive was not formatted and whether I would like to format it then.
Unfazed by this streak of failures I tried to mount it under Linux but, alas, to no avail. I might have tried every single -t operator under mount command but it still won't budge and let me mount.
View 5 Replies
View Related
Mar 24, 2010
I've had a look at some similar threads but as I'm very new to linux they're already a bit technical for me. Sorry, this calls for someone with patience. I gather from other threads that disconnecting an external drive without unmounting is a no-no, and this seems to be the likely cause. Now the disk is read only and I'm unable to change any settings through the usual control panel on ubuntu. I'm just not familiar with the terminal instructions. I tried to cut and past a few command lines from other threads but I got some warnings that proceding could damage data. Like this one: WARNING! Running e2fsck on a mounted filesystem may cause SEVERE filesystem damage.
View 5 Replies
View Related
Dec 1, 2010
Im reading in file /proc/cpuinfo into a char array.Im using strstr to search for a string im interested in (the cpu speed line) and storing it in another char array.I want to just store the line that contains CPU speed but im getting everything after the CPU speed line in the char array too.Is there anything better than strstr or is there someway i can parse the the payload data (i.e. the actual cpu speed)
View 4 Replies
View Related
Feb 25, 2011
I'm trying to format the output of ls -l, any help is appreciated
Quote:
[david@barca boot]$ ls
efi
grub
david@barca boot]$ cd efi/
[david@barca efi]# ls
EFI
[david@barca efi]# cd ../grub
[david@barca grub]# ls
device.map
now to long list files in each directory using one line:
Quote:
[david@barca boot]$ ls -l *
efi:
total 2
drwxr-xr-x. 3 root root 1024 May 13 2010 EFI
grub:
total 319
-rw-r--r--. 1 root root 70 Oct 26 17:12 device.map
How can I format the output of ls to get it all in single lines:
Quote:
drwxr-xr-x. 3 root root 1024 May 13 2010 efi/EFI
-rw-r--r--. 1 root root 70 Oct 26 17:12 grub/device.map
Any thoughts?
View 4 Replies
View Related
Nov 22, 2010
Is there any way to partition off say 40GB of a 250GB drive (only 5GB used) into an NTFS partition to install windows Vista SP1?? I have tried the System -> administration -> disk utility, but I can not figure out how to partition in it.
View 7 Replies
View Related
Mar 7, 2011
I have an command to read inputs from file2 and replace the content in file1. Issue is that the op is coming in a single line as gsub and split functions don't recognize new line characters.
Code:
awk 'NR==FNR{gsub(/input./,""); split($0,a," = ");b[a[1]]=a[2];next} {gsub(/@/,"");for (i in b) gsub(i,b[i])}1' $t2 $t3
This gives belwo op:
[Code]....
View 14 Replies
View Related
Mar 14, 2016
How to fill in zeros unrelocated space on hdd.
dd if=/dev/zero of=/dev/?????
View 14 Replies
View Related
Mar 9, 2010
What's the easiest way of formatting SD cards to FAT32 in Fedora linux?
Also, I'm having trouble when I try to unmount the volume of a SD card, there's 0.8 GB being used that I expect to be cleared when I choose to 'empty trash', everytime I select 'unmount volume' the SD card window just shuts down instead of clearing that space.
View 2 Replies
View Related
Jan 9, 2011
I've been asked to move data from an old external hard drive to a new one, and to make the new one compatible with the Macintosh. (The old drive's USB connection has died, and I'm connecting to old the drive using a PC card that provieds an eSATA to the drive. The recipient's Macintosh doesn't have a PC card slot, so she can't access the old drive anymore. Hence, the new drive.)
Naturally, I'm doing this data transfer using Linux. I've discovered that I can format the drive as HFS+ using mkfs.hfsplus from the hfsprogs package. But I need to know: do I need to do anything special with the partition table? Is there a special Macintosh partition table format that I need to format this disk to? If so, what tools can I use to get the right format for the partition table?
View 1 Replies
View Related
Jun 22, 2011
I'm looking for a way to force my PS1 variable to a certain number of chars.
It currently looks like:
$PS1="W $"
and I'm trying to keep the same number of characters regardless of the length of current folder name.
For example, both Documents and bin would be displayed as 10 character strings, keeping the left side of my terminal the same width all of the time.
View 1 Replies
View Related
Jan 3, 2010
Ive got two partitions of xubuntu installed and I only want one. Is there I way I can just delete the one i dont want and use that extra space for the other?
also, how would i know which is which when deleting?
View 9 Replies
View Related
Mar 2, 2010
A week ago I started a thread on Hardware & Laptops asking for help in formatting a USB stick.
Here is the thread:
[URL]
Before I toss away the 2GB stick, maybe somebody has some thoughts .
View 5 Replies
View Related
Mar 24, 2010
If Open Office had any problems saving in different file formats than the open format (which I know it doesn't have problems with) and rtf (which I know it does). I have to use it for school and I do not want to lose things like bullets, numbering and especially not information when saving in Microsoft Word formats.
View 7 Replies
View Related