Jump to content

Hard Disk Documentation


PigBucket
 Share

Recommended Posts

Hi - because I have a few hard drives installed and also dual boot with Windows, I manually keep a record of my hard disks and their partition information as a reference and for "just in case" situations. I was wondering if anyone was aware of any program/script that might gather this information for me a output it to a file so I can keep a copy on each disk. Here is what I manually document:-

 

It is basically an fdisk -l with some added bits in it, combined with a grub geometry, a copy of my fstab and a grep of hd and sd from dmesg.

 

root:! $ fdisk -l

Disk /dev/sda: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x3fbd3fbc

 

Device Boot Sz Start End Blocks Id System Name

/dev/sda1 * 1 1 8001 1 FAT12

/dev/sda2 2 19458 156282871+ f W95 Ext'd (LBA)

/dev/sda5 74Gb 2 9729 78140128+ 7 HPFS/NTFS XP

/dev/sda6 73Gb 9730 19458 78142680 83 Linux Mandriva 2008.1

grub> geometry (hd3)

drive 0x83: C/H/S = 19457/255/63, The number of sectors = 312581808, /dev/sda

Partition num: 0, Filesystem type is fat, partition type 0x1

Partition num: 4, Filesystem type unknown, partition type 0x7

Partition num: 5, Filesystem type is ext2fs, partition type 0x83

<------------------------------------------------------------------------------------>

Disk /dev/hda: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x0003f002

 

Device Boot Sz Start End Blocks Id System Name

/dev/hda1 * 1 1 8001 1 FAT12

/dev/hda2 2 2551 20482875 f W95 Ext'd(LBA)

/dev/hda3 112Gb 2552 16708 113716102+ c W95 FAT32(LBA) STORE

/dev/hda4 21Gb 16709 19457 22081342+ c W95 FAT32(LBA) MUSIC

/dev/hda5 20Gb 2 2551 20482843+ 7 HPFS/NTFS OLD_XP

grub> geometry (hd0)

drive 0x80: C/H/S = 19457/255/63, The number of sectors = 312581808, /dev/hda

Partition num: 0, Filesystem type is fat, partition type 0x1

Partition num: 2, Filesystem type is fat, partition type 0xc

Partition num: 3, Filesystem type is fat, partition type 0xc

Partition num: 4, Filesystem type unknown, partition type 0x7

<------------------------------------------------------------------------------------>

Disk /dev/hdb: 160.0 GB, 160041885696 bytes

255 heads, 63 sectors/track, 19457 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x4a9f9d05

 

Device Boot Sz Start End Blocks Id System Name

/dev/hdb1 * 1.5Gb 1 203 1630566 82 Linux swap

/dev/hdb2 204 16709 132584445 f W95 Ext'd(LBA)

/dev/hdb3 21.5Gb 16710 19457 22073310 83 Linux Mandriva 2006 home

/dev/hdb5 .8Gb 204 304 811251 83 Linux Mandriva 2008 home

/dev/hdb6 10Gb 305 1587 10305666 83 Linux Mandriva 2008

/dev/hdb7 .8Gb 1588 1684 779121 83 Linux PCLinux OS home

/dev/hdb8 10Gb 1685 2900 9767488+ 83 Linux PCLinux OS

/dev/hdb9 .8Gb 2901 2997 779121 83 Linux Ubuntu 804 home

/dev/hdb10 *10Gb 2998 4213 9767488+ 83 Linux Ubuntu 804

/dev/hdb11 .8Gb 4214 4314 811251 83 Linux Shared

/dev/hdb12 20Gb 4315 6870 20531038+ 83 Linux Mandriva 2006

/dev/hdb13 7Gb 6871 7785 7349706 b W95 FAT32 PHOTOS

/dev/hdb14 70Gb 7786 16709 71681998+ b W95 FAT32 BIGGEST

grub> geometry (hd1)

drive 0x81: C/H/S = 19457/255/63, The number of sectors = 312581808, /dev/hdb

Partition num: 0, Filesystem type unknown, partition type 0x82

Partition num: 2, Filesystem type is ext2fs, partition type 0x83

Partition num: 4, Filesystem type is ext2fs, partition type 0x83

Partition num: 5, Filesystem type is ext2fs, partition type 0x83

Partition num: 6, Filesystem type is ext2fs, partition type 0x83

Partition num: 7, Filesystem type is ext2fs, partition type 0x83

Partition num: 8, Filesystem type is ext2fs, partition type 0x83

Partition num: 9, Filesystem type is ext2fs, partition type 0x83

Partition num: 10, Filesystem type is ext2fs, partition type 0x83

Partition num: 11, Filesystem type is ext2fs, partition type 0x83

Partition num: 12, Filesystem type is fat, partition type 0xb

Partition num: 13, Filesystem type is fat, partition type 0xb

<------------------------------------------------------------------------------------>

Disk /dev/hdc: 80.0 GB, 80026361856 bytes

255 heads, 63 sectors/track, 9729 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Disk identifier: 0x49164915

 

Device Boot Sz Start End Blocks Id System Name

/dev/hdc1 * 25Gb 6493 9729 26001202+ 83 Linux Ubuntu 810

/dev/hdc2 2 6492 52138957+ f W95 Ext'd(LBA)

/dev/hdc5 50Gb 2 6325 50797498+ b W95 FAT32 EXTRA

/dev/hdc6 .2Gb 6326 6350 200749+ 82 Linux swap

/dev/hdc7 26Gb 6351 6492 1140583+ 82 Linux swap

grub> geometry (hd2)

drive 0x82: C/H/S = 9729/255/63, The number of sectors = 156301488, /dev/hdc

Partition num: 0, Filesystem type is ext2fs, partition type 0x83

Partition num: 4, Filesystem type is fat, partition type 0xb

Partition num: 5, Filesystem type unknown, partition type 0x82

Partition num: 6, Filesystem type unknown, partition type 0x82

<------------------------------------------------------------------------------------>

[root@localhost /]# more /etc/fstab

# Entry for /dev/sda6 :

UUID=a4ef60e9-443d-4aae-ae59-e9e80e5bd2ae / ext3 relatime 1 1

/dev/cdrom /media/cdrom auto umask=0,users,iocharset=utf8,noauto,ro,exec 0 0

none /proc proc defaults 0 0

 

# FAT Drives

# /dev/hda1 /mnt/win_c vfat umask=0,iocharset=utf8 0 0

/dev/hda3 /mnt/Store vfat umask=0,iocharset=utf8 0 0

/dev/hda4 /mnt/Music vfat umask=0,iocharset=utf8 0 0

/dev/hda5 /mnt/OldXP ntfs-3g defaults 0 0

 

# Entry for /dev/hdb1 :

UUID=e02f5999-e5d0-4d9d-b88e-87692a46f4de swap swap defaults 0 0

# /dev/hdb3 /mnt/mandy6h ext3 defaults 1 2

# /dev/hdb5 /mnt/mandy80h ext3 relatime 1 2

# /dev/hdb6 /mnt/mandy80 ext3 relatime 1 1

# /dev/hdb7 /mnt/pcosh ext3 defaults 1 2

# /dev/hdb8 /mnt/pcos ext3 defaults 1 2

# /dev/hdb9 /mnt/ubuntuh ext3 defaults 1 2

# /dev/hdb10 /mnt/ubuntu ext3 defaults 1 2

# /dev/hdb11 /mnt/shared ext3 defaults 1 2

# /dev/hdb12 /mnt/mandy6 ext3 defaults 1 2

/dev/hdb13 /mnt/Photos vfat umask=0,iocharset=utf8 0 0

/dev/hdb14 /mnt/Biggest vfat umask=0,iocharset=utf8 0 0

 

# /dev/hdc1 /mnt/ubuntu ext3 defaults 1 2

/dev/hdc5 /mnt/Extra vfat umask=0,iocharset=utf8 0 0

# Entry for /dev/hdc6 :

UUID=f43cccb1-3244-48d2-9561-242d58fdc3e5 swap swap defaults 0 0

# Entry for /dev/hdc7 :

# /dev/hdc7 swap swap defaults 0 0

 

# /dev/sda1 - small fat12 C drive

/dev/sda5 /mnt/XP ntfs-3g defaults 0 0

# /dev/sda6 /mnt/mandy81 ext3 defaults 1 2

<------------------------------------------------------------------------------------>

[root@localhost /]# dmesg |grep -E 'hd|sd'

hda: WDC WD1600JB-00REA0, ATA DISK drive

hda: 312581808 sectors (160041 MB) w/8192KiB Cache, CHS=19457/255/63

hda: hda1 hda2 < hda5 > hda3 hda4

 

hdb: WDC WD1600JB-22GVC0, ATA DISK drive

hdb: 312581808 sectors (160041 MB) w/8192KiB Cache, CHS=19457/255/63

hdb: hdb1 hdb2 < hdb5 hdb6 hdb7 hdb8 hdb9 hdb10 hdb11 hdb12 hdb13 hdb14 > hdb3

 

hdc: WDC WD800JB-00ETA0, ATA DISK drive

hdc: 156301488 sectors (80026 MB) w/8192KiB Cache, CHS=16383/255/63

hdc: hdc1 hdc2 < hdc5 hdc6 hdc7 >

 

hdd: HL-DT-STDVD-RAM GSA-H55N, ATAPI CD/DVD-ROM drive

hdd: ATAPI 48X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache

 

sd 0:0:0:0: [sda] 312581808 512-byte hardware sectors (160042 MB)

sda:<6>usb 3-2: configuration #1 chosen from 1 choice

sda1 sda2 < sda5 sda6 >

sd 0:0:0:0: [sda] Attached SCSI disk

sd 0:0:0:0: Attached scsi generic sg0 type 0

EXT3 FS on sda6, internal journal

[root@localhost /]#

 

Cheers - Pig

Link to comment
Share on other sites

Yes, it's very simple, just do:

 

fdisk -l > filename

 

putting this file wherever you want it to be. This will output all disk information to this file. If you want to append to the file use:

 

fdisk -l >> filename

 

notice the difference. This is good if you want to run a few commands to write all information to one file. For example:

 

fdisk -l /dev/sda > filename
fdisk -l /dev/sdb >> filename

 

using a single > you would overwrite the file if it existed.

Link to comment
Share on other sites

Thanks Ian - I'm already using the redirection (>) at the moment, but I was wondering if anybody knew of a script/program that would document the information I'm retrieving (fdisk, grub, fstab, dmesg) and pretty it up, without me having to reinvent the wheel. If I do it myself, I will probably write a script to do it.

 

Pig

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...