Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CREATING A NEW FILESYSTEM

Status
Not open for further replies.

johngiggs

Technical User
Oct 30, 2002
492
US
I'm new to UNIX administration and I am testing on a Linux box. I'm trying to create a new partition and then create a filesystem, but it doesn't seem to work. I tried using fdisk to create the partition, but then when I go to mount the filesystem, it's not there. Can someone please explain to me what the best way to go about creating a filesystem is?

Thanks,

John
 
There is a good tool called 'parted' that would make partitioning easier.

Anyway, what did you do with fdisk and mount - so we can see what went wrong... (remember, with fdisk, when done, you have to write the new parition info to disk for the changes to be made).

Also, what distro are you using as many have quite good tools themsleves - eg. Mandrake's "diskdrake".
 
Norwich,

I ran fdisk /dev/sda2 and chose n to create a new partition. I chose e for extended and partition number 4. When I pressed p, the new partition was displayed (/dev/sda2p4). I pressed w to write the changes, however I got an error message saying that reading the table failed - device busy. After that I rebooted the system and I still cannot mount the filesystem.

Thanks,

John
 
I tried following the steps at the website below, however I am still unable to mount the FS. I am getting the message:
/dev/sda4 is not a valid block device.


Does anyone have any ideas as to what I'm doing wrong?

Thanks,

John
 

Sorry if it's a stupid question but nowhere in your description do you actually create a file system.
Have you created a valid filesystem??

Cheers Henrik Morsing
Certified AIX 4.3 Systems Administration
& p690 Technical Support
 
OK...I crashed my first Linux box...now what...?

I don't think I was ever able to create a valid filesystem. I rebooted the system and it just comes back with a flashing cursor. How can I bring the system up in single user mode or some mode where I can attempt to repair the problem??

Thanks,

John
 
You didn't say which distro you are using so can't be too specific....

If you are using the LILO boot loader and are using the default linux kernel must will run up into single user mode by getting to the boot prompt (may need to hit space or tab if you have a splashscreen 'covering') and typing:

boot: linux 1

or

boot: linux single


If you are using the grub bootloader, then do as described in:


Alternatively, most distros will have some sort of rescue mode if you boot fromthe installation disk.


As for creating a valid file system, after you have created the partition, it should be visible after the reboot when you run fdisk again - together with the type of file system created.

To 'format' the partition, use "mkfs" to create the filesystem - the default will be ext2 so you'll need to pass the 'type' argument as ext3, jfs or reiser if you want a journaling system.

eg.

mkfs /dev/sda4

mkfs -t ext3 /dev/sda4

mkfs -r reiser /dev/sda4

(you may also want to use the -v "verbose" option to see what it's doing.)
 
I think that what I ended up doing was overwriting the original partition with a new partition, so as far as I know there was no way to recover it, so I ended up rebuilding the OS. BTW...the boot loader is GRUB.

Thanks,

John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top