LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   mounting (https://www.linuxquestions.org/questions/linux-software-2/mounting-568531/)

lordicon 07-11-2007 05:23 PM

mounting
 
i have fedora 7. I am trying to mount or format or do whatever needs to be done to change the file system of my 2nd 20gig hd that is in there so i can use it as a little extra free space... although, being new to linux i have not managed to find that command that will allow me to do such a thing. any ideas?

-Brandon

Simon Bridge 07-11-2007 05:36 PM

OK... back up: what do you have now? What do you want it to be?

I am guessing that you have a 20GiB HDD partitioned and formatted in some way you no longer need? You would like to change this to some partition + formatting you hope will be more useful to you?

Can you see the gaps in that description?

The partition tool most commonly used is called "parted" ... sometimes qparted and sometimes gparted and other things depending on the install. It is very likely that this is the tool you want.

Hern_28 07-11-2007 05:38 PM

Check on.
 
Might check on mkfs

I'm not positive fedora uses the same.

Looks like in fedora you would use fdisk to re-partition and format the drive and add the entry to the fstab to make it mount on boot.

lordicon 07-11-2007 05:42 PM

haha.. i see what you meen....

this is what i have:

[root@nani ~]# fdisk -l

Disk /dev/sda: 6448 MB, 6448619520 bytes
240 heads, 63 sectors/track, 833 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 14 105808+ 83 Linux
/dev/sda2 15 833 6191640 8e Linux LVM

Disk /dev/sdb: 20.4 GB, 20490559488 bytes
240 heads, 63 sectors/track, 2646 cylinders
Units = cylinders of 15120 * 512 = 7741440 bytes

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 2645 19996168+ 7 HPFS/NTFS


I would like to change /dev/sdb1 from NTFS to whatever a LINUX file system.

For the end result, i would like to be able to use 'sdb1' for more storage and not have to mount it every time i reboot my computer.

lordicon 07-11-2007 05:49 PM

[root@nani ~]# mkfs /dev/sdb1
mke2fs 1.39 (29-May-2006)
/dev/sdb1 is mounted; will not make a filesystem here!


is what i get with mkfs. but again i am still new

stress_junkie 07-11-2007 05:56 PM

Edit: this post was being written while the one above was being posted. Evidently your second hard drive is /dev/sdb and the partition is /dev/sdb1.

If your computer has only IDE disks then the second IDE disk will be accessed as /dev/hdb. I am not familiar with the Red Hat environment so I will tell you how to do this on any Linux system. It will require that you use the command line utilities.

The following procedure will destroy all data on the disk. If you want to preserve the data on the disk you can skip the parts about creating a partition table and about making a file system on the disk partition.

You first see if Linux can detect the hard drive using fdisk. Then you use cfdisk or fdisk to create a partition table. I recommend using cfdisk because it makes a graphic representation of the disk structure. Then you use mkfs to create a file system. Then you use the mount command to connect the file system on the second disk to a directory somewhere in the Linux file structure.

First log on as root.

Next see if Linux detects your second hard disk.
Code:

fdisk -l

Disk /dev/hda: 250.0 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start        End      Blocks  Id  System
/dev/hda1              1        1094    8787523+  7  HPFS/NTFS
/dev/hda2            1095        1155      489982+  82  Linux swap / Solaris
/dev/hda3  *        1156        2249    8787555  83  Linux

Here you can see that Linux only sees one hard disk on my system. If I had a second hard disk then the display would continue listing the partitions of that disk.

Use cfdisk to recreate the partition table on the second IDE disk.
Code:

cfdisk /dev/hdb
Cfdisk is a lot like the partition utility in the Windows installation software. Delete any partition that is there. Then create a partition. Make it a primary partition. Make the type a Linux partition. Write the partition table to disk. Quit.

Next see if Linux detects your changes by running fdisk -l again.

Now make a file system on the second hard disk using the mkfs utility.
Code:

mkfs -t ext3 /dev/hdb1
Now create a mount point. A mount point is a directory. Let's say that you want to mount the partition at /mnt/hdb1.
Code:

mkdir /mnt/hdb1
mount /dev/hdb1 /mnt/hdb1

Note that you only have to create the /mnt/hdb1 directory once. It will not go away unless you delete it.

Now allow your local users to access the disk by changing the ownership and permissions of the mount point with the partition mounted.
Code:

chown root:users /mnt/hdb1
chmod g+rwx /mnt/hdb1

You only have to do this one time as well. The permissions and ownership will remain unless you change them.

Now add a line in the file /etc/fstab to tell Linux to mount the partition every time the operating system starts.
Code:

cd /etc
cp fstab fstab.original

Now use any editor you like to edit the file /etc/fstab. Add this line to the end of that file.
Code:

/dev/hdb1  /mnt/hdb1  auto default 0 0
That should do it.

When I was adding tags to this discussion I found that there is already a mount+howto tag. You might want to search for that tag in the search feature on this web site. :)

AceofSpades19 07-11-2007 06:00 PM

you can't have a harddrive mounted when you make a parition

lordicon 07-11-2007 06:03 PM

-bash: cfdisk: command not found

stress_junkie 07-11-2007 06:03 PM

Quote:

Originally Posted by AceofSpades19
you can't have a harddrive mounted when you make a parition

I can't keep up with all the comments. I originally didn't know which post you were commenting on. Then I found out. Ooops. Sorry. Disregard this post.

stress_junkie 07-11-2007 06:05 PM

Quote:

Originally Posted by lordicon
-bash: cfdisk: command not found

I have to believe that cfdisk is available in the Red Hat repository. I was hoping that it was installed by default, as it is in some other distros. I haven't spent any serious amount of time with Red Hat for about ten years.

Cfdisk is a bit friendlier than fdisk.

lordicon 07-11-2007 06:06 PM

lol... so then... my next question will be... how do i unmount a harddrive so i can begin this little venture of mine?

Simon Bridge 07-11-2007 06:06 PM

Quote:

Originally Posted by lordicon
[root@nani ~]# mkfs /dev/sdb1
mke2fs 1.39 (29-May-2006)
/dev/sdb1 is mounted; will not make a filesystem here!


is what i get with mkfs. but again i am still new

# umount /dev/sdb1
# fdisk /dev/sdb1

... follow instructions.

stress_junkie 07-11-2007 06:09 PM

Quote:

Originally Posted by lordicon
lol... so then... my next question will be... how do i unmount a harddrive so i can begin this little venture of mine?

See if you have fdisk.
Code:

which fdisk
The only difference between cfdisk and fdisk is that the fdisk display is less informative. You still go through the same steps. When you start fdisk it will tell you the command for getting help. Then you just enter each step at the command line in the sequence that I listed above. :)

The Linux type of partition is number 83 in fdisk.

lordicon 07-11-2007 06:09 PM

following instructions...

[root@nani ~]# fdisk /dev/sdb1

The number of cylinders for this disk is set to 2489.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

lordicon 07-11-2007 06:13 PM

for everything in fdisk that i attempt to do i'm asked for a partition number 1-4 i am not quite sure how to find which partition number i am supposed to use

Command (m for help): t ext3
Partition number (1-4):

i am aware of the fact that i am not typing things in right at all times... i am afraid though of messing something up


All times are GMT -5. The time now is 02:20 PM.