Archive for March, 2005

factor

Thursday, March 31st, 2005

factor 32321321321321
32321321321321: 32321321321321

I read about factor here: http://www.redhat.com/magazine/005mar05/departments/tips_tricks/

then tried it.  The first number I typed came back prime!

Copying an NTFS disk over the network using tomsrtbt

Friday, March 4th, 2005

I’ve got an old SCSI NTFS disk that I’ve got to get the information out
of.  I had it installed on my linux box where I could mount the
disk directly, but I pulled it out and closed up the system and forgot
to copy the image over to the big disk there.

I had done this in the past and used the linux ntfs driver
to mount the disk and copy the files.  The big disk went bad, I
got it replaced and forgot to copy the NTFS.  Anway, I was looking
for a way to copy the disk without opening up the Linux box again.

I put the SCSI card and drive into an old P5-100 and booted from a tomsrtbt
floppy.  The SCSI drive and network came up, I added an entry to
the /etc/fstab for an nfs mount and mounted it.  So far, so good.

I tried this dd if=/dev/sda of=/public/old-drive.ntfs and it looked
good up to 2G when I got “File Size Exceeded.”  I poked about and
found dd-lfs (dd for large file systems) which claims to have no 32 bit
file size limit.  It didn’t work either.  There’s something
in there that doesn’t like going over 2G.  Anyway, I decided to
try to split the file with dd into chunks.  Here’s the script I
ran:

for i in 0 1 2 3 4 5 6 7 8 9

do

  dd-lfs if=/dev/sda of=/public/old-drive.ntfs.$i bs=1000 count=1000000 skip=${i}000000

done

It worked, I got this:

-rw-r–r–  1 root root 1000000000 Mar  3 23:54 old-drive.ntfs.0

-rw-r–r–  1 root root 1000000000 Mar  4 00:04 old-drive.ntfs.1

-rw-r–r–  1 root root 1000000000 Mar  4 00:14 old-drive.ntfs.2

-rw-r–r–  1 root root 1000000000 Mar  4 00:25 old-drive.ntfs.3

-rw-r–r–  1 root root 1000000000 Mar  4 00:34 old-drive.ntfs.4

-rw-r–r–  1 root root 1000000000 Mar  4 00:45 old-drive.ntfs.5

-rw-r–r–  1 root root 1000000000 Mar  4 00:55 old-drive.ntfs.6

-rw-r–r–  1 root root 1000000000 Mar  4 01:05 old-drive.ntfs.7

-rw-r–r–  1 root root 1000000000 Mar  4 01:16 old-drive.ntfs.8

-rw-r–r–  1 root root  100032000 Mar  4 01:17 old-drive.ntfs.9

Here’s the script to put it back together:

for i in 0 1 2 3 4 5 6 7 8 9

do

  dd if=/public/old-drive.ntfs.$i of=/public/old-drive.ntfs bs=1000 count=1000000 seek=${i}000000

done

Thre result:

-rw-r–r–  1 root root 9100032000 Mar  4 10:32 old-drive.ntfs

Which looked good to me.  Now just mount it and we’re good to go.

WRONG!


mount old-drive.ntfs /public/old-drive -t ntfs -r -o umask=0222


mount: old-drive.ntfs is not a block device (maybe try `-o loop’?)



ok, it’s not a block device so we’ll loop the file:


mount old-drive.ntfs /public/old-drive -t ntfs -r -o umask=0222 -o loop


mount: wrong fs type, bad option, bad superblock on /dev/loop0,


       or too many mounted file systems


       (could this be the IDE device where you in fact use


       ide-scsi so that sr0 or sda or so is needed?)




and this shows up in the /var/log/messages


NTFS-fs error (device loop0): ntfs_fill_super(): Not an NTFS volume.

NTFS-fs error (device loop0): read_ntfs_boot_sector(): Primary boot sector is invalid.

NTFS-fs error (device loop0): read_ntfs_boot_sector(): Mount option errors=recover not used. Aborting without trying to recover.


OK, let’s do the loop separately and check it out:


losetup /dev/loop0 /public/old-drive.ntfs


let’s look at the loop content


head /dev/loop0  | od -c



looks good I see NTFS stuff and PARTITION INFORMATION!!!!

let’s try this:
 fdisk -l /dev/loop0

 


Disk /dev/loop0: 9100 MB, 9100032000 bytes


255 heads, 63 sectors/track, 1106 cylinders


Units = cylinders of 16065 * 512 = 8225280 bytes


 


      Device
Boot     
Start        
End      Blocks   Id  System


/dev/loop0p1
  
*          
1       
1106     8883913+   7  HPFS/NTFS





very interesting, we’ve got the whole drive image including the
partition table.  More interesting is the /dev/loop0p1 device!


mount /dev/loop0p1 /public/old-drive -t ntfs -r


mount: special device /dev/loop0p1 does not exist


This post (http://lists.samba.org/archive/linux/2004-December/012635.html) gives some insight.  It’s just printed out as a convenince, there’s  no such device (except at NASA apparently).

The post goes on to say that I can use the offset parameter to go farther into the loop file for the beginning of the device.

losetup -o 32256 /dev/loop0 /public/old-drive.ntfs

mount /dev/loop0 /public/old-drive -t ntfs -r

Apparently I could have done this in one command:

mount /public/old-drive.ntfs /public/old-drive -t ntfs -r -o loop,offset=32256