Find the answer to your Linux question:
Results 1 to 4 of 4
Hello Forum: I have this partition: Disk /dev/sdf: 96.6 GB, 96636764160 bytes 255 heads, 63 sectors/track, 11748 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Posts
    11

    Disk Partition Interpretetion


    Hello Forum:

    I have this partition:

    Disk /dev/sdf: 96.6 GB, 96636764160 bytes
    255 heads, 63 sectors/track, 11748 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000

    Device Boot Start End Blocks Id System
    /dev/sdf1 1 11749 94371808+ 83 Linux

    When I try to find the partition's space, I get nothiing:

    bash disk_space.sh /dev/sdg
    Partition:
    Total size:
    Used space:
    Free space:

    Where disk_space.sh is a script that provides the output above. For example, on this partition:

    Disk /dev/sda: 73.0 GB, 72999763968 bytes
    255 heads, 63 sectors/track, 8875 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00058792

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 64 512000 83 Linux
    Partition 1 does not end on cylinder boundary.
    /dev/sda2 64 8876 70775808 8e Linux LVM

    I get this info out of the script:

    Partition: /dev/sda1
    Total size: 485M
    Used space: 40M
    Free space: 420M

    Can anyone tell me why I do not get a similar result from the /dev/sdg partition?

    Can someone tell me what this means?

    Thanks.

  2. #2
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    913
    /dev/sdf is a block device (hdd most likely)
    /dev/sdf1 is a partition on /dev/sdf

    Note, you wrote "bash disk_space.sh /dev/sdg" as opposed to /dev/sdf1

  3. #3
    Just Joined!
    Join Date
    Dec 2007
    Posts
    11
    Correct, /dev/sdf is a block device and /dev/sdf1 is a partition. However, what I do not understand is why I dont get why I don't get its total size, used space, and free space when I run the script:

    #!/bin/sh

    #run as: bash disk_space.sh /dev/sda,
    #where /dev/sda is the name of the disk.

    DISC=$1
    PARTITION=`df -h | grep $DISC | awk '{print $1}'`
    SIZE=`df -h | grep $DISC | awk '{print $2}'`
    USED=`df -h | grep $DISC | awk '{print $3}'`
    FREE=`df -h | grep $DISC | awk '{print $4}'`

    echo "Partition: $PARTITION"
    echo "Total size: $SIZE"
    echo "Used space: $USED"
    echo "Free space: $FREE"

    When I run the script on another partition, I get those results:

    [w@b scripts.d]$ bash disk_space.sh /dev/sda
    Partition: /dev/sda1
    Total size: 485M
    Used space: 40M
    Free space: 420M
    [w@b scripts.d]$

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Sep 2012
    Location
    India
    Posts
    29
    Hi,

    As discussed above
    your hard disk - /dev/sdf
    hard disk partition is - /dev/sdf1 in ext3 file format as id is 83
    block size is - 512 bytes

    When you run the bash script as { bash disk_space.sh /dev/sda }
    your input is /dev/sda will match all partition starting with /dev/sda{1,2,3,4,5} but will not include /dev/sdf

    run the script as { bash disk_space.sh /dev/sd }
    will match /dev/sda1 & /dev/sdf1

    Regards,
    Best Wishes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •