List HD Partitions - Hardware

This is a discussion on List HD Partitions - Hardware ; Hi - I'll keep it short. How can I list all drive partitions/filesystems -- Linux or otherwise. I would like to mount a Windows partition, but I dont know which it is? I've tried cat /etc/fstab but I'm not sure ...

+ Reply to Thread
Results 1 to 13 of 13

Thread: List HD Partitions

  1. List HD Partitions

    Hi -

    I'll keep it short. How can I list all drive partitions/filesystems --
    Linux or otherwise. I would like to mount a Windows partition, but I
    dont know which it is? I've tried cat /etc/fstab but I'm not sure if
    this is the way to go.

    Thanks,

    - Olumide


  2. Re: List HD Partitions


    Olumide wrote:
    > Hi -
    >
    > I'll keep it short. How can I list all drive partitions/filesystems --
    > Linux or otherwise. I would like to mount a Windows partition, but I
    > dont know which it is? I've tried cat /etc/fstab but I'm not sure if
    > this is the way to go.
    >
    > Thanks,
    >
    > - Olumide


    Hi Olumide,

    As root, use the following command:

    fdisk -l (small "L" for list)
    HTH,
    -T


  3. Re: List HD Partitions

    On 15 Nov 2006 18:42:29 -0800, Olumide wrote:
    > Hi -
    >
    > I'll keep it short. How can I list all drive partitions/filesystems --
    > Linux or otherwise. I would like to mount a Windows partition, but I
    > dont know which it is? I've tried cat /etc/fstab but I'm not sure if
    > this is the way to go.


    You put your partition is /etc/fstab when you know what type and
    where.

    you can use cfdisk of fdisk to list partitions.
    You can then see what the system wants for mounting with the commands:

    mkdir /junk
    mount -t auto /dev/hdXY /junk you solve for X and Y
    mount | grep junk
    umount /junk

    That information is what you set in /etc/fstab

    After you modified fstab, test it.

    mount /where/ever
    ls /where/ever


  4. Re: List HD Partitions

    Olumide schrieb:
    > Hi -
    >
    > I'll keep it short. How can I list all drive partitions/filesystems --
    > Linux or otherwise. I would like to mount a Windows partition, but I
    > dont know which it is? I've tried cat /etc/fstab but I'm not sure if
    > this is the way to go.
    >
    > Thanks,
    >
    > - Olumide
    >

    try
    cat /proc/partitions

  5. Re: List HD Partitions

    Thanks everyone.

    Just one more thing though, how can I find out which logical partitions
    are carved out of the same physical drive?


  6. Re: List HD Partitions

    On 16 Nov 2006 09:07:37 -0800, Olumide wrote:
    > Thanks everyone.
    >
    > Just one more thing though, how can I find out which logical partitions
    > are carved out of the same physical drive?


    Usually, 4 is the partition containing logical partitions numbered 5 and up.

    When the first 8 letters of a partition identifier are the same
    (/dev/DDD), they are on the same physical device.

  7. Re: List HD Partitions

    On Thu, 16 Nov 2006 09:07:37 -0800, Olumide wrote:

    > Thanks everyone.
    >
    > Just one more thing though, how can I find out which logical partitions
    > are carved out of the same physical drive?


    (on Fedora.. not sure about other distros )
    dmesg ( or maybe cat /var/log/dmesg ) | grep -i sector
    will show you the drives that were detected at boot time.


    dmesg | grep -i sector
    hdb: 234441648 sectors (120034 MB) w/8192KiB Cache, CHS=16383/255/63, UDMA(100)
    ata1: dev 0 ATA-6, max UDMA/133, 78125000 sectors: LBA48
    SCSI device sda: 78125000 512-byte hdwr sectors (40000 MB)
    SCSI device sda: 78125000 512-byte hdwr sectors (40000 MB)


    you can view the partions defined by doing ( for /dev/sda for example )
    fdisk -l /dev/sda
    that gives:

    Disk /dev/sda: 40.0 GB, 40000000000 bytes
    255 heads, 63 sectors/track, 4863 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 13 104422 83 Linux
    /dev/sda2 14 144 1052257+ 82 Linux swap / Solaris
    /dev/sda3 145 4863 37905367+ 83 Linux

    anything after '4' is most likely on the extended partion. For a drive
    with an extended partion:
    fdisk -l /dev/sdb

    Disk /dev/sdb: 300.0 GB, 300069052416 bytes
    255 heads, 63 sectors/track, 36481 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 13 104391 83 Linux
    /dev/sdb2 14 144 1052257+ 82 Linux swap / Solaris
    /dev/sdb3 145 6518 51199155 83 Linux
    /dev/sdb4 6519 36481 240677797+ 5 Extended
    /dev/sdb5 6519 36481 240677766 83 Linux

    the 'extended' partion covers the rest of the disk. The logical
    ( #5 or larger ) partions are carved out of the large, Extended
    partion.

    jack



    --
    D.A.M. - Mothers Against Dyslexia

    see http://www.jacksnodgrass.com for my contact info.

    jack - Grapevine/Richardson

  8. Re: List HD Partitions

    On Thursday 16 November 2006 18:14, Bit Twister stood up and addressed the
    masses in /comp.os.linux.misc/ as follows...:

    > On 16 Nov 2006 09:07:37 -0800, Olumide wrote:
    >> Thanks everyone.
    >>
    >> Just one more thing though, how can I find out which logical partitions
    >> are carved out of the same physical drive?

    >
    > Usually, 4 is the partition containing logical partitions numbered 5 and
    > up.


    Only if there are three primary partitions in front of it. ;-)

    Logical partitions always start with number 5, but the extended partition
    container itself is also a primary partition - i.e. it has its entry in the
    MBR partition table - and its number will be that of the first available
    primary partition.

    So if you have one primary partition before the extended partition
    container, the extended partition container will have number 2. 4 is the
    highest possible number for an extended partition container since it *is*
    in effect a primary partition by itself, and the MBR partition table can
    only hold four entries - which is why there was a need for logical
    partitions in the first place.

    Of course, the above does not really apply to EFI-based systems. Systems
    with an EFI BIOS can have up to 128 primary partitions per disk.

    Another interesting thing to note is that the SCSI protocol - as used by
    SCSI disks, but also by SATA-I/II and USB drives - only allows for a
    maximum of 15 partitions per device, whereas PATA/IDE hard disks can hold
    up to - I believe - 61 partitions.

    --
    With kind regards,

    *Aragorn*
    (registered GNU/Linux user #223157)

  9. Re: List HD Partitions


    Aragorn wrote:
    > On Thursday 16 November 2006 18:14, Bit Twister stood up and addressed the
    > masses in /comp.os.linux.misc/ as follows...:
    >
    > > On 16 Nov 2006 09:07:37 -0800, Olumide wrote:
    > >> Thanks everyone.
    > >>
    > >> Just one more thing though, how can I find out which logical partitions
    > >> are carved out of the same physical drive?

    > >
    > > Usually, 4 is the partition containing logical partitions numbered 5 and
    > > up.

    >
    > Only if there are three primary partitions in front of it. ;-)
    >
    > Logical partitions always start with number 5, but the extended partition
    > container itself is also a primary partition - i.e. it has its entry in the
    > MBR partition table - and its number will be that of the first available
    > primary partition.
    >
    > So if you have one primary partition before the extended partition
    > container, the extended partition container will have number 2. 4 is the
    > highest possible number for an extended partition container since it *is*
    > in effect a primary partition by itself, and the MBR partition table can
    > only hold four entries - which is why there was a need for logical
    > partitions in the first place.


    *sigh* ... isn't there some command that can show the relationship
    bewteen all partitions in a tree-like hierachy? (Laziness, the good
    kind, is the mother of all invention.)


  10. Re: List HD Partitions

    Aragorn wrote:
    >
    > Another interesting thing to note is that the SCSI protocol - as used by
    > SCSI disks, but also by SATA-I/II and USB drives - only allows for a
    > maximum of 15 partitions per device, whereas PATA/IDE hard disks can hold
    > up to - I believe - 61 partitions.


    That has nothing to do with the SCSI protocol. It's simply a side
    effect of the way the Linux kernel allocates device numbers for SCSI
    hard disk devices.

  11. Re: List HD Partitions

    Olumide wrote:
    >
    > *sigh* ... isn't there some command that can show the relationship
    > bewteen all partitions in a tree-like hierachy? (Laziness, the good
    > kind, is the mother of all invention.)


    There's no need for that IMHO. You can have up to 4 primary partitions,
    of which 0 or 1 is an extended partition containing logical drives. The
    tree will have 1 level (up to 4 primaries) or 2 levels (primary
    partitions and logical drives and any logical drives will be part of the
    one and only extended partition).

    The tree will either look like:

    whole device
    |
    -- partition 1
    |
    -- ...
    |
    -- partition n (n <= 4)

    or:

    whole device
    |
    -- partition 1
    |
    -- ...
    |
    -- partition n (n <= 4) EXTENDED
    |
    -- logical drive 1
    |
    -- ...

    Unless you're using some oddball system there will never be two extended
    partitions. So when you look at the output of 'fdisk -l', all
    partitions number 5 or higher will be within the only extended partition
    you see.

    There, now you have your tree-like hierarchy.

  12. Re: List HD Partitions

    ["Followup-To:" header set to comp.os.linux.hardware.]
    On 2006-11-16, Olumide <50295@web.de> wrote:

    > I'll keep it short. How can I list all drive partitions/filesystems --
    > Linux or otherwise. I would like to mount a Windows partition, but I
    > dont know which it is? I've tried cat /etc/fstab but I'm not sure if
    > this is the way to go.


    Try "/sbin/fdisk -l /dev/hd[whatever]" E.g.:

    [john@vector john]$ sudo /sbin/fdisk -l /dev/hda

    Disk /dev/hda: 12.0 GB, 12072517632 bytes
    255 heads, 63 sectors/track, 1467 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hda1 1 220 1767118+ 83 Linux
    /dev/hda2 261 1467 9695227+ 5 Extended
    /dev/hda3 221 260 321300 82 Linux swap / Solaris
    /dev/hda5 261 746 3903763+ 83 Linux
    /dev/hda6 747 989 1951866 83 Linux
    /dev/hda7 990 1232 1951866 83 Linux
    /dev/hda8 1233 1263 248976 82 Linux swap / Solaris
    /dev/hda9 1264 1467 1638598+ 83 Linux

    Device numbers 1-4 are primary partitions; 5 and above are logical
    partitions inside the extended partition. You are only allowed one
    extended partition per physical device, but it can contain many logical
    partitions.

    --

    John (john@os2.dhs.org)

  13. Re: List HD Partitions

    Olumide wrote:
    > Aragorn wrote:
    > > ...
    > > So if you have one primary partition before the extended partition
    > > container, the extended partition container will have number 2. 4 is the
    > > highest possible number for an extended partition container since it *is*
    > > in effect a primary partition by itself, and the MBR partition table can
    > > only hold four entries - which is why there was a need for logical
    > > partitions in the first place.

    >
    > *sigh* ... isn't there some command that can show the relationship
    > bewteen all partitions in a tree-like hierachy? (Laziness, the good
    > kind, is the mother of all invention.)


    Output of fdisk -l :

    Disk /dev/sda: 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/sda1 * 1 30401 244196001 c Win95 FAT32 (LBA)

    Disk /dev/hda: 81.9 GB, 81964302336 bytes
    255 heads, 63 sectors/track, 9964 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hda1 * 1 2611 20972826 7 HPFS/NTFS
    /dev/hda2 2612 4570 15735667+ 83 Linux
    /dev/hda3 4571 4603 265072+ 82 Linux swap
    /dev/hda4 4604 9963 43054200 c Win95 FAT32 (LBA)

    Disk /dev/hdb: 15.3 GB, 15361597440 bytes
    255 heads, 63 sectors/track, 1867 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/hdb1 1 1867 14996646 7 HPFS/NTFS

    I see ... hda[1-4] partitions are partitioned from the 82Gb disk
    (bought 2 years ago), and the hdb1 is from the 16Gb disk (bought 6
    years ago). The sda1 I suppose is the 250Gb external USB drive that I
    bought today.

    Looks like sda1 has been automounted to /media/sda1 :-) . Output of cat
    /ect/fstab:

    /dev/hda2 / ext3 defaults
    1 1
    /dev/hda3 swap swap pri=42
    0 0
    devpts /dev/pts devpts mode=0620,gid=5
    0 0
    proc /proc proc defaults
    0 0
    usbdevfs /proc/bus/usb usbdevfs noauto
    0 0
    /dev/cdrom /media/cdrom auto
    ro,noauto,user,exec 0 0
    /dev/dvd /media/dvd auto
    ro,noauto,user,exec 0 0
    /dev/fd0 /media/floppy auto noauto,user,sync
    0 0
    /dev/sda1 /media/sda1 auto sync,noauto,user,exec 0 0 #HOTPLUG
    B3Fu.kLXse11go55


+ Reply to Thread