Firewire disks

If it's a firewire disk, it's probably /dev/sda or /dev/sdb.
Note: '/dev/sda' refers to the first scsi disk in the system
'/dev/sdb' refers to the second ...
...
further,
'/dev/sdb' refers to the entire second disk.
'/dev/sdb1' refers to the first partition on the second disk.

***Be very careful with these commands; they will absolutely,permanently wipe out any existing data on the disk.


The following is a copy of a session in which I repartitioned and reformated the disk.
Follow the 5 steps described below.

If you can't mount the disk and have an I/O error

as root su -
/usr/local/bin/rescan-scsi-bus.sh
you might have to do it twice

Step 1 Look at the disk partitioning info and make sure it's the right disk.

You will probably need to be root

The '-l' (for "list") is important! If you forget it, you'll end up in interactive fdisk, where you could accidentally wipe out the disk.
hmmm... that doesn't look like a backup disk! and it's very small
5116671+1020127+11639092=17775890 which is only ~18gb.
---------------------------------------------------------
[root@w02 pxuser]$ su -
password (ask for password)

[root@w02 root]# fdisk -l /dev/sda


Disk /dev/sda: 255 heads, 63 sectors, 2213 cylinders
Units = cylinders of 16065 * 512 bytes

Device Boot    Start       End    Blocks   Id  System
/dev/sda1             1       637   5116671   83  Linux
/dev/sda2           638       764   1020127+  82  Linux swap
/dev/sda3           765      2213  11639092+  83  Linux
-------------------------------------------------------------
 In this case w02 has a scsi system disk, and that is it. Lets try sdb.

This looks much better! a single giant partition (~120gb) which matches the size printed on the disk.  Unfortunately it has an NTFS filesystem which we can't use under linux.

The number of cylinders for this disk is set to 14596.  There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs  (e.g., DOS FDISK, OS/2 FDISK)

-------------------------------------------------------------
[root@w02 root]# fdisk -l /dev/sdb

Disk /dev/sdb: 255 heads, 63 sectors, 14596 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1     14596 117242338+   7  HPFS/NTFS
-------------------------------------------------------------
Step 2a Stick it on the windows pc in the x12c lab (x12c-l) and use one of the gui ftp programs or sftp to copy everything; this is going to be pretty slow.

Step2b Repartition and reformat it with FAT32 and then use it as normal under linux.
You should probably stick it on x12c-l just to see if there's data on it and definitely ask the disk owner beforere partitioning and formating it.


The rest of this assumes you've decided there's nothing important on the disk and repartitioning and reformating are the way to go.







[root@w02 root]# fdisk /dev/sdb
 

It rarely hurts to look at the help, so I do
----------------------------------------------------------------------

Command (m for help): m
Command action
   a   toggle a bootable flag
   b   edit bsd disklabel
   c   toggle the dos compatibility flag
   d   delete a partition
   l   list known partition types
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table
   p   print the partition table
   q   quit without saving changes
   s   create a new empty Sun disklabel
   t   change a partition's system id
   u   change display/entry units
   v   verify the partition table
   w   write table to disk and exit
   x   extra functionality (experts only)

----------------------------------------------------------------------
Doesn't hurt to look at the disk partitions and double check you're operating on the correct disk.

----------------------------------------------------------------------
Command (m for help): p

Disk /dev/sdb: 255 heads, 63 sectors, 14596 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1     14596 117242338+   7  HPFS/NTFS
----------------------------------------------------------------------
Step 3 Here we delete the current partition


----------------------------------------------------------------------
Command (m for help): d
Partition number (1-4): 1

----------------------------------------------------------------------
Check that did what we wanted.

----------------------------------------------------------------------

Command (m for help): p

Disk /dev/sdb: 255 heads, 63 sectors, 14596 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
----------------------------------------------------------------------
Step 4 Create a new partition which covers the whole disk ----------------------------------------------------------------------
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-14596, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-14596, default 14596):
Using default value 14596

----------------------------------------------------------------------
Check that did what we wanted.
----------------------------------------------------------------------
Command (m for help): p

Disk /dev/sdb: 255 heads, 63 sectors, 14596 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1     14596 117242338+  83  Linux

----------------------------------------------------------------------
Next we change the file system type to FAT32 LBA

----------------------------------------------------------------------

Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): L

 0  Empty           1c  Hidden Win95 FA 65  Novell Netware  bb  Boot Wizard hid
 1  FAT12           1e  Hidden Win95 FA 70  DiskSecure Mult c1  DRDOS/sec (FAT-
 2  XENIX root      24  NEC DOS         75  PC/IX           c4  DRDOS/sec (FAT-
 3  XENIX usr       39  Plan 9          80  Old Minix       c6  DRDOS/sec (FAT-
 4  FAT16 <32M      3c  PartitionMagic  81  Minix / old Lin c7  Syrinx
 5  Extended        40  Venix 80286     82  Linux swap      da  Non-FS data
 6  FAT16           41  PPC PReP Boot   83  Linux           db  CP/M / CTOS / .
 7  HPFS/NTFS       42  SFS             84  OS/2 hidden C:  de  Dell Utility
 8  AIX             4d  QNX4.x          85  Linux extended  df  BootIt
 9  AIX bootable    4e  QNX4.x 2nd part 86  NTFS volume set e1  DOS access
 a  OS/2 Boot Manag 4f  QNX4.x 3rd part 87  NTFS volume set e3  DOS R/O
 b  Win95 FAT32     50  OnTrack DM      8e  Linux LVM       e4  SpeedStor
 c  Win95 FAT32 (LB 51  OnTrack DM6 Aux 93  Amoeba          eb  BeOS fs
 e  Win95 FAT16 (LB 52  CP/M            94  Amoeba BBT      ee  EFI GPT
 f  Win95 Ext'd (LB 53  OnTrack DM6 Aux 9f  BSD/OS          ef  EFI (FAT-12/16/
10  OPUS            54  OnTrackDM6      a0  IBM Thinkpad hi f0  Linux/PA-RISC b
11  Hidden FAT12    55  EZ-Drive        a5  FreeBSD         f1  SpeedStor
12  Compaq diagnost 56  Golden Bow      a6  OpenBSD         f4  SpeedStor
14  Hidden FAT16 <3 5c  Priam Edisk     a7  NeXTSTEP        f2  DOS secondary
16  Hidden FAT16    61  SpeedStor       a9  NetBSD          fd  Linux raid auto
17  Hidden HPFS/NTF 63  GNU HURD or Sys b7  BSDI fs         fe  LANstep
18  AST SmartSleep  64  Novell Netware  b8  BSDI swap       ff  BBT
1b  Hidden Win95 FA
Hex code (type L to list codes): c
Changed system type of partition 1 to c (Win95 FAT32 (LBA))

---------------------------------------------------------------------
Check that did what we wanted and write. Command (m for help): p

Disk /dev/sdb: 255 heads, 63 sectors, 14596 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1     14596 117242338+   c  Win95 FAT32 (LBA)

----------------------------------------------------------------------
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
----------------------------------------------------------------------
Check that did what we wanted. [root@w02 root]# fdisk -l /dev/sdb

Disk /dev/sdb: 255 heads, 63 sectors, 14596 cylinders
Units = cylinders of 16065 * 512 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sdb1             1     14596 117242338+   c  Win95 FAT32 (LBA)
----------------------------------------------------------------------
Step 5  Format the partition (this may take a little while).
Use "mkfs .ext3 /dev/sdb1" for Linux format


[root@w02 root]# mkdosfs -vF 32 /dev/sdb1
mkdosfs 2.8 (28 Feb 2001)
/dev/sdb1 has 255 heads and 63 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 234484676 sectors;
file system has 2 32-bit FATs and 8 sectors per cluster.
FAT size is 228543 sectors, and provides 29253444 clusters.
Volume ID is 3f8dcc0c, no volume label.
----------------------------------------------------------------------

Note: if there is a question about the disk having bad blocks, you could add a '-c' (ie. 'mkdosfs -vcF 32 /dev/sdb1') to check for badblocks before formating, but that will take a *long* time.

[pxsys@w02 pxsys]$ mount /w02/1394_data1
[pxsys@w02 pxsys]$ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/sda1              5036284   3684716   1095736  78% /
/dev/sda3             11456384     32828  10841604   1% /w02/data1
none                    256828         0    256828   0% /dev/shm
w05:/w05/data1       474506328 212255264 238147544  48% /w05/data1
java:/img03/data1    967653948 353193160 566069008  39% /img03/data1
/dev/sdb1            117013776         4 117013772   1% /w02/1394_data1
----------------------------------------------------------------------
Another handy thing is knowing how to run the filesystem checker on the firewire disks, which should be done when they're not unmounted cleanly due to being unplugged before being unmounted, or the machine crashing and the power button getting hit... If you get errors about the filesystem being read only due to errors, this is what you need to do:

***You should never run fsck on a mounted filesystem, so we umount it first.


If the errors are bad enough, it will refuse to automatically fix them,and you'll have to And answer the questions it asks. If this has to be done, it's entirely possible that some files have become corrupted or have been lost entirely.











[pxsys@w02 pxsys]$ umount /dev/sdb1; dosfsck -av /dev/sdb1

[pxsys@w02 pxsys]$ umount /dev/sdb1; dosfsck -v /dev/sdb1