LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to format the hard disks(removable & fixed) ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-format-the-hard-disks-removable-and-fixed-582971/)

himy 09-07-2007 12:16 PM

how to format the hard disks(removable & fixed) ?
 
what are the commands to format the hard disks and flash drives in fedora 7, with desired file system? and how can i transfer my hard-disks into linux, that were earlier under windows-xp?

Simon Bridge 09-07-2007 12:23 PM

man parted
man fdisk

Quote:

how can i transfer my hard-disks into linux, that were earlier under windows-xp?
Not sure about this question: do you want to turn old fat/ntfs drives into ext3/whatever? Or do you want to be able to access stuff on the XP drive using linux?

himy 09-07-2007 12:33 PM

Quote:

Originally Posted by Simon Bridge (Post 2884653)
man parted
man fdisk

Not sure about this question: do you want to turn old fat/ntfs drives into ext3/whatever? Or do you want to be able to access stuff on the XP drive using linux?

i want to make old drives work in linux permanently without mounting them all the time. Is formatting them with ext3/whatever.. is the only way?

fltltpankaj 09-07-2007 12:50 PM

there are two ways of doing it.

Firstly, By making an entry in /etc/fstab file in Linux. This will result in auto mounting of old drives containing windows data, without your intervention. In this case you can work on these drives from linux without any hassles.

Secondly, as you said you can format the drives as ext2 or ext3 and mount in filesysytem.

Simon Bridge 09-07-2007 12:51 PM

Quote:

i want to make old drives work in linux permanently without mounting them all the time
It is not possible to access any drive without mounting it, I suspect you are confused. What do you mean by "work"?

I am guessing you want the OS to mount the drive for you when you boot instead of having to type in the mount command or use the user mount tool.

gedit /etc/fstab

This is the file-system table...
add your drive to the bottom. It's pretty easy to follow by comparing with partitions that automount. You need to read the manpage for fstab for details.

PTrenholme 09-07-2007 03:18 PM

And, to answer you original question, use the mke2fs command to create a file system on a physical partition. (Despite the e2 in the command name, it can also be used to created ext3 file systems. See man mke2fs for instructions.)

If you'd like to keep your disks in NTFS (and preserve the data on them), do a yum install ntfs-3g and make entries in your /etc/fstab like this:
Code:

# Added by hand . . .
/dev/sda1              /hd/c                  ntfs-3g rw,uid=root,gid=disk 0 0
/dev/sda2              /hd/d                  vfat    uid=root,gid=disk 0 0

#
# SMB file system (Handled by automount: See /etc/auto.master and /etc/auto.cifs)
#
# USB Drive
/dev/USB_Fedora/Base    /usb                    ext3  defaults,noauto  0 0
LABEL=/boot2            /usb/boot              ext3  defaults,noauto  0 0
LABEL=/shared          /usb/shared            ext3  defaults,noauto  0 0

The entries in bold are for a NTFS partition and a FAT partition. Both mount the disk with "root" as the owner and anyone in the "disk" group with r/w access to the partitions.

The entries at the end show how I mount my USB drive partitions. Note that my USB drive contains a logical volume with a Fedora Core 6 installation on it. The "noauto" option tell Fedora 7 to "file and ignore" the definitions untill I attach the drive and run the following script:
Code:

$ cat Scripts/MountUsb
#! /bin/bash
dev="/dev/sda"
if [ x"$1" = "x" ];
then
  dev="/dev/sda"
else
  dev=$1
fi
# Mount ${dev} if it exists
if [ -b ${dev} ]; then
    sudo /sbin/vgchange -a y USB_Fedora
    sudo mount /usb
    sudo mount /usb/boot
    sudo mount /usb/shared
else
    echo Drive ${dev} was not found.
fi


Simon Bridge 09-07-2007 08:31 PM

PTrenholme: a quite complete reply there... I suspect the parts about ntfs-3g are the bits actually wanted. I have some observations:

I see you do not use drive labels in fstab, I understand f7 s OK with this but fedora is moving towards increased HW abstraction.

For the fstab entries to work, don't the directories /hd /hd/c and /hd/d need to exist?

Arn,t these directory names susceptible to confusion with hdc and hdd?

Aren't user mounted partitions better in /mnt or /media? In your case, /mnt/sda1 and /mnt/sda2 are more usual. Some people prefer mounting under /media, and maybe a more descriptive name like /media/winC and /media/winD ... it is usually frowned-upon to create directories off root just for this sort of thing.

The udev system in f7 is supposed to automount USB partitions. But I see the fedora-usb installation is on an LVM volume ("logical volume is too easy to confuse with logical partition)... an annoying habit fedora has these days. Not really needed for a single physical volume and it would probably mess up the normal automount.

Sometimes, answering the original question faithfully and completely can just lead to more confusion and "WTF" style reactions from newcomers. I mean, if you'd just come from windows and saw that usb-mount script, you'd go "WTF: I just plug them in in windows, what a useless OS!"

OTOH: my, "read the manual", response with "I don't understand the question" could be said to leave something to be desired.

So I'd be interested in what OP has to say.

PTrenholme 09-08-2007 05:27 PM

Quote:

Originally Posted by Simon Bridge (Post 2885019)
PTrenholme: a quite complete reply there... I suspect the parts about ntfs-3g are the bits actually wanted. I have some observations:

I see you do not use drive labels in fstab, I understand f7 s OK with this but fedora is moving towards increased HW abstraction.

Well, I've got some drives with duplicated labels on some partitions, so the /LABEL= directive gets confused.

Quote:

For the fstab entries to work, don't the directories /hd /hd/c and /hd/d need to exist?
Yes.

Quote:

Aren't these directory names susceptible to confusion with hdc and hdd?
Not on Fedora 7: All fedora drives are sda, etc.

Quote:

Aren't user mounted partitions better in /mnt or /media? In your case, /mnt/sda1 and /mnt/sda2 are more usual. Some people prefer mounting under /media, and maybe a more descriptive name like /media/winC and /media/winD ... it is usually frowned-upon to create directories off root just for this sort of thing.

Perhaps, but, hey, Linux is about freedom, eh?

Quote:

The udev system in f7 is supposed to automount USB partitions. But I see the fedora-usb installation is on an LVM volume ("logical volume" is too easy to confuse with logical partition)... an annoying habit fedora has these days. Not really needed for a single physical volume and it would probably mess up the normal automount.
"Automount" just ignores the LVM partitions. And my /usb tree is set to mimic the root tree I have when I boot from the USB drive.

Quote:

Sometimes, answering the original question faithfully and completely can just lead to more confusion and "WTF" style reactions from newcomers. I mean, if you'd just come from windows and saw that usb-mount script, you'd go "WTF: I just plug them in in windows, what a useless OS!"

OTOH: my, "read the manual", response with "I don't understand the question" could be said to leave something to be desired.

So I'd be interested in what OP has to say.
Yes, me too.

And I agree that "too much" can be confusing, but I felt that the OP could benefit from an actual example. Perhaps -- well, probably -- I should not have included anything about the USB drive, although the OP asked about removable media as well as fixed disks.

cojo 09-08-2007 05:47 PM

Not on Fedora 7: All fedora drives are sda, etc.

This is not true. Fedora see all SATA, USB, SCSI drives as sd*. It still see IDE drive as hd*.

Simon Bridge 09-08-2007 06:45 PM

Quote:

Well, I've got some drives with duplicated labels on some partitions, so the /LABEL= directive gets confused.
... wow... I guess that can happen if you have a drive which hosted a previous install. Developers seem to expect you to relabel the drive or explicitly set a different label on the new drive or have all drives installed at the distro install or something. I, personally, don't see the point of so much abstraction (on a home desktop) - it just seems to be the "in" thing. No doubt I just earned a lecture...

[hd/c confuse with hdc etc]
Quote:

Not on Fedora 7: All fedora drives are sda, etc.
Yeah I know that, you know that... have you never had anyone new who'd read an old howto? Never mind, it's a niggle anyway.

[partitions better in /mnt or /media?]
Quote:

Perhaps, but, hey, Linux is about freedom, eh?
Perhaps, but should an individual "custom method" be presented to a novice?

[LVM volume ... would probably mess up the normal automount.]
Quote:

"Automount" just ignores the LVM partitions. And my /usb tree is set to mimic the root tree I have when I boot from the USB drive.
As suspected. And mimicing like that makes the setup clearer for you when you are not booting from usb. It's a good idea.

Quote:

And I agree that "too much" can be confusing, but I felt that the OP could benefit from an actual example. Perhaps -- well, probably -- I should not have included anything about the USB drive, although the OP asked about removable media as well as fixed disks.
"Removable media" could be a floppy, a pendrive, a CD-ROM ... hopefully OP hasn't been put off by our little discussion and will clear that up for us ;)

You have provided a nice solution with that USB, and the ensuing discussion should have provided enough references so people looking for that solution have a chance of finding it.

Most of my questions were really concerned with "what to tell newbies"... it could be that OP read your post and just "got it" but found my approach mystifying: which knocks me right off my high horse. So they are not very heavy criticisms.

Anyway, it gives us something to do while we're waiting for OP to reply :D

Quote:

Originally Posted by cojo
Fedora see all SATA, USB, SCSI drives as sd*. It still see IDE drive as hd*.

Really, it's not supposed to?

fedora 7 release notes
Quote:

n this release, all hard disk partitions follow a /dev/sd* naming convention due to a new libata driver interface in the kernel.
cojo: are you really still using RH8??!

cojo 09-08-2007 06:54 PM

Simon Bridge,

Yes and No. I do have one system I managed is running RH8. But, all my system are either Red Hat 2.1 to 5 or Fedora 1 to 6. Also, I'm just too lazy to update my profile.....LOL

PTrenholme 09-09-2007 06:23 PM

Quote:

Originally Posted by cojo (Post 2885940)
Not on Fedora 7: All fedora drives are sda, etc.

This is not true. Fedora see all SATA, USB, SCSI drives as sd*. It still see IDE drive as hd*.

Well, perhaps on yous system. I don't have any hard drives that aren't IDE, and they all register as sd* when I do a fdisk -l. Here's an example from this laptop:
Code:

$ /sbin/fdisk -l
 
 Disk /dev/sda: 80.0 GB, 80026361856 bytes 255 heads, 63 sectors/track, 9729 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
    Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *        894        5730    38853202+  7  HPFS/NTFS
/dev/sda2              1        893    7172991    b  W95 FAT32
/dev/sda3            5731        5743      104422+  83  Linux
/dev/sda4            5744        9729    32017545    5  Extended
/dev/sda5            5744        9729    32017513+  8e  Linux LVM



All times are GMT -5. The time now is 01:12 PM.