Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
OK, this is the question asked ALOT, but I can't find the 1-2-3 solution that should be available for this common question. I do apologize for the repeat question...but telling me to read the documentation, reference material, or FAQ won't help because I have tried. (And yes, I am kind of slow...OK, stupid, I admit it)
I have a secondary drive on my new RedHat Linux computer and I want to make it permanently accessible from the RedHat system that is now running on the computer.
It is an old Windows NTFS drive that was a secondary drive when this was a Windows machine.
What do I need to do to, and how do I do it:
1) Format it into a format that Linux uses.
2) After it is formatted correctly, permanently mount it so it will always be accessible
3) After it is successfully formatted and mounted, how do I access it? (For example, to add a new ascii text file to it via 'cp')
how name of disk? fdisk -l
1. mkfs.ext4 partition. likely, should be changed partition table before.
2. mount partition mount_point; echo "partition mount_point ext4 default 1 2" >> /etc/fstab
3. partition is in mount_point. for example in /mnt/disk. cp file /mnt/disk/file
Create a new directory on an existing drive, for example "/home/user-name/more_space".
Now it's all done as root.
Find your disk
Code:
fdisk -l
will show you all your disks
Which one is the old windows disk ? Well, you can see which one has a windows format in the list that fdisk just showed you.
Example output:
Code:
Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 13 104391 83 Linux
/dev/hda2 14 4751 38057985 83 Linux
/dev/hda3 4752 4865 915705 82 Linux swap / Solaris
Notice there are no windows drives in that output.
If you wanted to work on this disk you would enter
Code:
fdisk /dev/hda
in the next section.
Prepare your disk
Code:
fdisk /dev/<device-name>
will allow you to work on that disk you found in the section above. Usually <device-name> is /dev/hdX or /dev/sdX. Ignore the numbers after the letters. The numbers are partitions. X stands for the letter you found in the last section.
sdX is for SATA or scsi disks. hdX is for ide or PATA disks.
Once in fdisk, there are several commands :
p print the partition table
n create a new partition
d delete a partition
q quit without saving changes
w write the new partition table and exit
So choose p to see what partitions there are on the disk. Then use d to delete the first partition you found on that disk.
Choose d until all partitions on that disk are gone.
Then choose n then p and create one primary partition (enter 1 when asked).
Make it the default size which is the whole of the disk (just hit enter)
Then enter w to save your changes, and q to quit fdisk.
Format your disk
Code:
mke2fs -j /dev/hdX1
(or /dev/sdX1 depending on what the device is called above)
will format the drive as ext3. ext4 is fairly new so stick to what works.
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233
Rep:
except that putting the mount point in your user's home directory limits the contents to that user, ok if only you use that machine
personally i would make a mount point under /media or /mnt
smoker,
Many thanks. This is exactly what I needed.
Just a quick couple of follow-ups if you would be patient with me!
I may have gotten off track with the fdisk d (delete) option.
See - you couldn't hold my hand completely!
I did delete number 1.
After trying to delete others I moved on to the mke2fs command.
Here's what I get (and a follow up with fdisk -l):
/ : [162]
mke2fs -j /dev/hda
mke2fs 1.39 (29-May-2006)
/dev/hda is entire device, not just one partition!
Proceed anyway? (y,n) y
/dev/hda is apparently in use by the system; will not make a filesystem here!
/ : [164]
fdisk -l
Disk /dev/hda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda2 14 38913 312464250 8e Linux LVM
Disk /dev/hdb: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 9726 78124063+ 8e Linux LVM
Firstly, you have linux using part of that drive you are trying to wipe. Is that really what you want to do ?
Code:
/dev/hda2 14 38913 312464250 8e Linux LVM
I believe I covered that in Find your disk.
Secondly, you skipped the whole "making a new partition" part
Code:
So choose p to see what partitions there are on the disk. Then use d to delete the first partition you found on that disk.
Choose d until all partitions on that disk are gone.
Then choose n then p and create one primary partition (enter 1 when asked).
Make it the default size which is the whole of the disk (just hit enter)
Then enter w to save your changes, and q to quit fdisk.
So open fdisk again
Code:
fdisk /dev/hda
and create a new primary partition where the old one was, following the instructions above. You don't need to delete anything this time.
When you've done that, go on to the mke2fs part but the command will be
Code:
mke2fs -j /dev/hda1
(as I said it would be)
Once that's done, you are back on track. Carry on from Mount your disk.
As stated your NTFS disk is not being recognized or is it actually dev/hdb.
Typically two partitions are created with a default install i.e. /boot and LVM which will contain your / and swap. If you deleted hda1 then you have deleted your /boot. If you recreate the partition exactly like it was all of the files should still be intact.
As stated your NTFS disk is not being recognized or is it actually dev/hdb.
Typically two partitions are created with a default install i.e. /boot and LVM which will contain your / and swap. If you deleted hda1 then you have deleted your /boot. If you recreate the partition exactly like it was all of the files should still be intact.
Why is hdb1 showing as bootable ?
I know linux can't boot from an LVM...
A 23GB boot partition ?
Code:
Disk /dev/hda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda2 14 38913 312464250 8e Linux LVM
Code:
Disk /dev/hdb: 80.0 GB, 80000000000 bytes
255 heads, 63 sectors/track, 9726 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hdb1 * 1 9726 78124063+ 8e Linux LVM
That doesn't explain a 23GB boot partition. But of course I don't know what the OP deleted. I would have thought it was unlikely that RH put the boot on an NTFS drive, and the OP was instructed to only delete non-linux partitions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.