Copying an NTFS disk over the network using tomsrtbt

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

Linux Joke

November 23rd, 2004

$ ls -l / | grep tmp
drwxr-xr-x 3 root root 4096 Nov 23 04:02 tmp

Organic Chocolate Chip Cookies

October 16th, 2004

In a mixer mix:


1 stick butter (4 oz room temperature)


3/4 cup Rapadura


2 tsp vanilla


then add:


1 egg


In another bowl mix:


1/2 cup whole wheat flour


1/2 cup almond meal


2 tbsp unprocessed wheat bran


1/2 tsp salt


1/2 tsp baking soda


mix the wet and dry ingredients.


Add


1 cup / 12 oz chocolate chips / chunks (2 rapunzel chocolate bars will do)


Bake at 375 F for 9-11 minutes.

Snake Food

August 1st, 2004

We went to the Science Museum and happened to go upstairs ot the labs just at the right time to see a corn snake eat a mouse.

WebSphere Install Update

July 29th, 2004

I did a scripted install of ND 5.1 and BASE 5.1 on Linux last night.  I used some Java code to enable java security and set all the TCP/IP ports to the standard.  The whole process took 8 minutes and 10 seconds.  This included ND install, BASE install and federation.

Creating Web-based user interfaces: Using WebSphere Studio V5.1.2 to develop JavaServer Faces applications

July 2nd, 2004

From developerWorks


http://www.ibm.com/developerworks/edu/i-dw-wes-wesjsf-i.html?S_TACT=104AHW57&S_CMP=TNL&ca=dnt-526


Learn how to useJavaServer Faces (JSF) technology within WebSphere Studio V5.1.2. The tutorial walks you through a simple application example that makes use of JavaServer Faces in order to implement a simple messaging center. Using the WebSphere Studio tools, you will see how easy it is to build Web applications that are based on JavaServer Faces and how easy it is to support functions relating to event handling, validation and navigation using visual tools and declarations rather than having to write long tedious code.

Navy Joke

July 1st, 2004

“Two battleships assigned to the training squadron had been at sea on manoeuvers in heavy weather for several days. I was serving on the lead battleship and was on watch on the bridge as night fell. The visibility was poor with patchy fog, so the Captain remained on the bridge keeping an eye on all activities. Shortly after dark, the lookout on the wing of the bridge reported, “Light, bearing on the starboard bow.”
“Is it steady or moving astern?” the Captain called out.
Lookout replied, “Steady, Captain,” Which meant we were on a dangerous collision course with that ship.
The Captain then called to the signalman, “Signal that ship: We are on a collisoon course, advise you change course 20 degrees.”
Back came the signal “Advisable for you to change course 20 degrees.”
In reply, the Captain said, “Send: I’m a captain, change course 20 degrees.”
“I’m a seaman second class,” Came the reply, “You had better change course 20 degrees.”
By that time, the Captain, was furious. He spat out, “Send: I’m a battleship, change course 20 degrees.”
Back came the flashing light: “I’m a lighthouse!”

We changed course.”

Linux Answering Machine

June 22nd, 2004

Simple setup for Linux answering machine: http://alpha.greenie.net/vgetty/readme_beginners.html


 


 

SquirrelMail is Nobody

June 2nd, 2004

https://www.siwko.org/wordpress/?p=244

OK, this was an easy one.  I had two copies of apache running, one with the Red Hat /etc/httpd/conf install and one I compiled into /usr/local/apache2.  SSL was running on the /usr/local copy.  I don’t recall why I did this, but it is likely that I couldn’t do SSL with the Red Hat version.

It was time to add a virtual host and I decided to fix up everything and drag it into one server.  I decided to recompile and move up to the latest httpd (2.0.49).  Here’s the configure script I used:

export CPPFLAGS=-I/usr/kerberos/include
time bash configure –prefix=/usr/local/apache-2.0.49 –enable-ssl –enable-proxy –enable-so –disable-ipv6
time make
time make install

When I was trying to get the thing running I had to read some docs because my guesses were a bit off.  To confgure virtual hosts, the argument to NameVirtualHost has to match the attribute to the <VirtualHost> tag which processes it, not the server name.

If the SSLPassPhraseDialog fails, the server can fail with very little warning.  I had to strace the process before I saw that there were errors logged in the ssl log.  It turns out that I had a script returning the passphrase with the wrong security.

So, finally I got everything up and running, I tried both virtual hosts, the proxy through to Tomcat and the SSL virtual host.  From there I went on to SquirrelMail where I found I couldn’t get to my prefs.  I checked the data directory and it’s owned by nobody.  So, here’s the answer:  /usr/local/apache2 was running as user nobody while /etc/httpd was running as apache.  I had set the new server to run as apache while the old one was running as nobody.  The two servers before accessing the data directory as different users caused the original problem.

Ephemeral Ports

April 26th, 2004

Here’s a good description with instructions for changing the range: http://www.ncftpd.com/ncftpd/doc/misc/ephemeral_ports.html