LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Finding out new drive in /dev (https://www.linuxquestions.org/questions/linux-newbie-8/finding-out-new-drive-in-dev-694110/)

louieb39 12-31-2008 01:56 PM

Finding out new drive in /dev
 
I pluged in an external drive, I'm trying to mount it.

Its xfs.

My question is, how do I find out what the drive is called in /dev?

Running ubuntu with no gui.

David the H. 12-31-2008 02:20 PM

"fdisk -l" will list all the available drives on your system and their corresponding dev entries.

"cat /proc/partitions" is another simple way to get a list of all available partitions, albeit without much in the way of other defining information.

louieb39 12-31-2008 03:09 PM

Quote:

Originally Posted by David the H. (Post 3392853)
"fdisk -l" will list all the available drives on your system and their corresponding dev entries.

"cat /proc/partitions" is another simple way to get a list of all available partitions, albeit without much in the way of other defining information.

Thanks m8!

Anyway to find out how much space is on each drive in /dev?

David1357 12-31-2008 04:09 PM

Quote:

Originally Posted by louieb39 (Post 3392875)
Anyway to find out how much space is on each drive in /dev?

Used space or total space?

louieb39 12-31-2008 04:31 PM

Quote:

Originally Posted by David1357 (Post 3392911)
Used space or total space?

total space

David1357 12-31-2008 04:47 PM

Quote:

Originally Posted by louieb39 (Post 3392924)
total space

"fdisk -l" produces output like this
Code:

[machine:~]:fdisk -l

Disk /dev/sda: 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/sda1  *          1        1305    10482381    7  HPFS/NTFS
/dev/sda2            1306        6527    41945715  83  Linux
/dev/sda3            6528        9138    20972857+  83  Linux
/dev/sda4            9466        9726    2096482+  82  Linux swap / Solaris

Is that the size in bold what you are looking for?

louieb39 12-31-2008 05:58 PM

Quote:

Originally Posted by David1357 (Post 3392935)
"fdisk -l" produces output like this
Code:

[machine:~]:fdisk -l

Disk /dev/sda: 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/sda1  *          1        1305    10482381    7  HPFS/NTFS
/dev/sda2            1306        6527    41945715  83  Linux
/dev/sda3            6528        9138    20972857+  83  Linux
/dev/sda4            9466        9726    2096482+  82  Linux swap / Solaris

Is that the size in bold what you are looking for?


fdisk -l produces this

Cannot open /dev/sda
Cannot open /dev/sdb
Cannot open /dev/sdc

i92guboj 12-31-2008 06:04 PM

Not sure but you might need to be root for this.

You might be able to use this to become root:

Code:

sudo /sbin/fdisk -l
Or

Code:

su -
Then enter the root password.

Ps. Tip: once the disks are mounted you can get more info using "df". Of, if you can, install pydf, which will give you a nicer output.

louieb39 12-31-2008 06:38 PM

Quote:

Originally Posted by i92guboj (Post 3392990)
Not sure but you might need to be root for this.

You might be able to use this to become root:

Code:

sudo /sbin/fdisk -l
Or

Code:

su -
Then enter the root password.

Ps. Tip: once the disks are mounted you can get more info using "df". Of, if you can, install pydf, which will give you a nicer output.


Thanks! sudo was able to produce the info I needed

Aparently the drive is NTFS, could of sworn it was XFS

Sorry for another noob question, but how would I reformat the drive to XFS?

i92guboj 12-31-2008 07:08 PM

Use mkfs.xfs

You might need to install xfsprogs or whatever it's called on your distro.

louieb39 12-31-2008 07:53 PM

Quote:

Originally Posted by i92guboj (Post 3393053)
Use mkfs.xfs

You might need to install xfsprogs or whatever it's called on your distro.

thanks for the help guys

Ok so I reformated the drive with fdisk

made it xfs with mkfs.xfs command

used fdisk to make a partition

Now I'm trying to mount the drive into a folder /B

I did

sudo mount -t xfs /dev/sdc /B

and I'm getting this


mount: wrong fs type, bad option, bad superblock on /dev/sdc,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

any ideas?

i92guboj 12-31-2008 08:05 PM

Quote:

Originally Posted by louieb39 (Post 3393075)
thanks for the help guys

Ok so I reformated the drive with fdisk

made it xfs with mkfs.xfs command

used fdisk to make a partition

Now I'm trying to mount the drive into a folder /B

I am not sure I understood you ok.

First thing, is that fdisk doesn't format anything. It just deletes and creates partitions. Few things more.

Actually, formating is the process to create a file system. So, mkfs is what takes care of that part.

The process would be more like this:

Code:

fdisk /dev/sdc
#make partitions and use the 'w' command to write and exit
#you might need to reboot (or maybe not)
mkfs.xfs /dev/sdc1

Assuming that you created a single primary partition inside sdc, it will be called sdc1. Note the slight -but very important- distinction. sdc is the whole block device, sdc1 is the first primary partition. You can create more of course, as long as you have free -non partitioned- space on that drive.

Quote:

sudo mount -t xfs /dev/sdc /B
It's possible to format the drive as a whole, without partitioning it, but you usually don't do that. Hence, if you followed the convention and partitioned the drive the right way, that command should be:

Code:

sudo mount -t xfs /dev/sdc1 /B
If you can't sort it out with the info I provided, paste here exactly the commands that you used. Note that a single character can make a very big difference.

louieb39 12-31-2008 08:28 PM

Thank you! Its mounted and working now.

louieb39 01-13-2009 03:06 PM

Is it possible to make the drive automatically mount on boot?

i92guboj 01-13-2009 03:14 PM

Sure. Add it to /etc/fstab.

Check the man page for fstab and mount if you need extra help, and ask here again if you can't figure out how to do it. You can use the already existing lines in that file for inspiration.


All times are GMT -5. The time now is 09:35 PM.