recovering from 8.4 upgrade to restore 8.1 freebsd

HI, I have a 500gb WD My Book external hard drive via USB. I formatted it using Ubuntu...using gpart to format the external harddrive to FAT32. However, the problem is that my server isn't runnable. So, I am booting off a USB stick that has FreeBSD 8.4 installation memory image. I then use the Fixit feature to get into a shell.

Now, I do this: mount -t msdosfs -o large /dev/da2 /mnt That is what I typed in. I get a error in response saying invalid argument.

Then I tried this command: gpart show da2 When I type that I get 3 lines of text. The first one shows a BSD and the second shows a ? as the filesystem. I don't know what this means. However, I can only mount my server's internal hard drive. I cannot at all mount my external USB drive.

Are there any commands I can try that will help me figure out why it's acting funny? Do I have to reformat my external hard drive? Or do you think Ubuntu's gpart fat32 should work and the Ubuntu is like a version 6 an old version. I don't know if that makes a difference or not.

Any help would be appreciated. :beer
 
It's not clear what you're trying to do.

Rather than describing the output of gpart(8), it would be more useful to just show it.

The message indicates that da2 is not an MS-DOS filesystem. Most of the time, filesystems are in partitions. For example, it could be /dev/da2s1.
 
wblock@ said:
It's not clear what you're trying to do.

Rather than describing the output of gpart(8), it would be more useful to just show it.

The message indicates that da2 is not an MS-DOS filesystem. Most of the time, filesystems are in partitions. For example, it could be /dev/da2s1.

I have a server that I upgraded recently from FreeBSD 8.1 to FreeBSD 8.4. It worked but when I upgraded the ports it detected my perl and php was outdated so it upgrade them to the very latest versions. This resulted the shell to no longer work after a reboot.
However, before I upgraded the system. I did a dump of my server's internal hard drive and did a dump of the mbr image on the hard drive. I stored that on my external hard drive. I then transferred it to my Windows 7 machine. I moved it on my Windows 7 machine and then with my server. I booted it into Ubuntu version 6 point something. I usedgpart to format my external hard drive tofat32. I then connected it back to my Windows 7 machine and made the copies of the dumps to my external hard drive. I have a usb stick that I put the FreeBSD 8.4 memory image installation disk on it. I then boot using it for my server and I make my way to the fixit feature and use usb to get into a shell envirement.

So, the above is what I did. I checked the directory of /dev It shows the devices there. I only see da2 andda2a.
I don't see anything that shows it like da2s1 etc.

When I do a gpart show it shows 3 lines of info. One line has the tetters BSD. The second line has something like !0 and the third line has ? I am guessing that is the filesystem information.

I can mount to my internal hard drive and which is device da0 and I see da0a and da0s1, da0s2, da0s3. That is what I see in my /dev directory and I am able to mount my internal hard drive. The problem is just my external usb hard drive that I cannot mount.

I one time last week did use the FreeBSD 8.4 memstick image on my external hard drive and made it a bootable drive. I then later formatted it to afat32. I am not sure if this caused issues. The program I used did write to the boot sector of the external hard drive and I am not sure if it's still acting like a none fat32 file system .
 
hockey97 said:
I have a server that I upgraded recently from FreeBSD 8.1 to FreeBSD 8.4. It worked but when I upgraded the ports it detected my perl and php was outdated so it upgrade them to the very latest versions. This resulted the shell to no longer work after a reboot.

Did you replace root's shell with bash?

However, before I upgraded the system. I did a dump of my server's internal hard drive and did a dump of the mbr image on the hard drive. I stored that on my external hard drive.

Okay, good.

I then transferred it to my Windows 7 machine.

The dump(8) files, I think. Okay.

then with my server. I booted it into Ubuntu version 6 point something. I usedgpart to format my external hard drive tofat32.

Why? Why not just use the Windows system?

I then connected it back to my Windows 7 machine and made the copies of the dumps to my external hard drive.

Kind of getting lost here. Why reformat the external drive?

I have a usb stick that I put the FreeBSD 8.4 memory image installation disk on it. I then boot using it for my server and I make my way to the fixit feature and use usb to get into a shell envirement.

Okay.

So, the above is what I did. I checked the directory of /dev It shows the devices there. I only see da2 andda2a.
I don't see anything that shows it like da2s1 etc.

da2a is probably the memory stick. Hard to tell.

When I do a gpart show it shows 3 lines of info. One line has the tetters BSD. The second line has something like !0 and the third line has ? I am guessing that is the filesystem information.

Nope. The reason I ask for the output of gpart show is that it will show information on all the attached disks and the partitions on them. "Something like" does not give any of that information.

I can mount to my internal hard drive and which is device da0 and I see da0a and da0s1, da0s2, da0s3. That is what I see in my /dev directory and I am able to mount my internal hard drive. The problem is just my external usb hard drive that I cannot mount.

Please show the output of ls /dev/ad* /dev/da*.

I one time last week did use the FreeBSD 8.4 memstick image on my external hard drive and made it a bootable drive. I then later formatted it to afat32. I am not sure if this caused issues. The program I used did write to the boot sector of the external hard drive and I am not sure if it's still acting like a none fat32 file system .

I could tell you how to blow away the partition table, but if it was the wrong drive, that would be bad. The gpart output would help to identify the drive and the problem.
 
wblock@ said:
then with my server. I booted it into Ubuntu version 6 point something. I usedgpart to format my external hard drive tofat32.

Why? Why not just use the Windows system?

Ok, I read most of your post but right now it's late to monkey around with the server right now. Give me about 2 days and I will take a picture of the screen shot of what I see on the screen when I type in gpart show.

The reason I used Ubuntu was because Windows 7 doesn't have fat32 as an option to format. It has extfat and ntfs only either options. I downloaded some programs for windows 7 that formats a hard drive to fat32 but the program won't run.

I don't have time today to give you what you asked for. Since I got classes in the morning tomorrow and I need to finish homework for them. So, I will post a response here on Tuesday night EST. Since I don't have class on that day. I will take a picture of the screen showing the output. I am sure that the da2 is the device of my external hard drive since camcontrol devlist displays my WD 500gb device as da2. I just think the format is messed up and it's because I made the external hard drive last week to a bootable FreeBSD 8.4 memory image and I notice it wrote something in the boot sectors. I think those are not wipe clean and might be the reason for the confusion. I am not sure but that's my guess.


Update: I will post a picture of what I see on the screen and use the comments you want to see the output results from them. I will do this... coming this weekend Feb 1st or 2nd on EST. I just got alot of things to do right now.
 
Below I show a picture of my computer screen. I typed in gpart show and this is what it shows :

0131141809.jpg


0131141809a.jpg


0131141809b.jpg



below is the picture of the computer screen showing the command I issued which wasls /dev/da*
I did do both you asked which is another command : ls /dev/ad* but this one showed nothing.

0131141824.jpg


0131141825.jpg


0131141825a.jpg



Do right click on the images and copy the image links to your browsers url box. View the pictures directly since on the forum it 's showing them cut off.
 
da0 is really odd. It may be some hybrid MBR/GPT setup.

In that output, da2 is the 500G drive.

The following instructions assume there is no information on that disk. If there is, it will be erased, so back up first if necessary. I advise also backing up or temporarily disconnecting that da0 drive, it is just too easy to get drives mixed up and wipe out the wrong one.

To erase the formatting and replace it with something useful, boot into that Fixit environment again. First, use gpart show da2 to make sure it is still called da2 and shows 465G.

Remove the partitioning scheme:
# gpart destroy -F da2
If that gives an error because you are using pretty old FreeBSD tools:
# gpart delete -i1 da2
# gpart destroy da2

That will leave the disk unformatted.

Create a standard MS-DOS partitioning scheme:
# gpart create -s mbr da2

Add a single slice that fills the whole drive:
# gpart add -t \!12 da2

Format the new MS-DOS filesystem:
# newfs_msdos -F32 /dev/da2s1

That drive should now be readable by nearly any system.
 
wblock@ said:
da0 is really odd. It may be some hybrid MBR/GPT setup.

In that output, da2 is the 500G drive.

The following instructions assume there is no information on that disk. If there is, it will be erased, so back up first if necessary. I advise also backing up or temporarily disconnecting that da0 drive, it is just too easy to get drives mixed up and wipe out the wrong one.

To erase the formatting and replace it with something useful, boot into that Fixit environment again. First, use gpart show da2 to make sure it is still called da2 and shows 465G.

Remove the partitioning scheme:
# gpart destroy -F da2
If that gives an error because you are using pretty old FreeBSD tools:
# gpart delete -i1 da2
# gpart destroy da2

That will leave the disk unformatted.

Create a standard MS-DOS partitioning scheme:
# gpart create -s mbr da2

Add a single slice that fills the whole drive:
# gpart add -t \!12 da2

Format the new MS-DOS filesystem:
# newfs_msdos -F32 /dev/da2s1

That drive should now be readable by nearly any system.


I followed the instruction but my External hard drive is stll da2.

I am able to mount it but I cannot find where I can find the files on my external hard drive.

I wrote this command: mount_msdosfs -o large /dev/da2s1 /mnt

That is what I wrote and cannot find the files. Since I need to restore the mbr and the dump which resides on my external hard drive. Yes, I know you walked me through formatting my external hard drive to a FAT32 system. I plugged my external hard drive in my windows 7 machine. It transferred the files back to the external drive.

Is there a way I can check to see where it's mounted? I did a ls /mnt which shows another /mnt/mnt/username/ These folders don't have anything in them. How can reference the path to my external hard drive to the exact file that I need to restore?
 
hockey97 said:
I followed the instruction but my External hard drive is stll da2.

I am able to mount it but I cannot find where I can find the files on my external hard drive.

I wrote this command: mount_msdosfs -o large /dev/da2s1 /mnt

The recommended form is mount -t msdosfs -o large /dev/da2s1 /mnt, but the other form should also work.

That is what I wrote and cannot find the files. Since I need to restore the mbr and the dump which resides on my external hard drive. Yes, I know you walked me through formatting my external hard drive to a FAT32 system. I plugged my external hard drive in my windows 7 machine. It transferred the files back to the external drive.

Is there a way I can check to see where it's mounted?

You told it to mount at /mnt. If there were no errors, that's where it mounted the filesystem. The rest depends on where the files were copied in by Windows. If they are in the root of that filesystem, they will be in /mnt.

I did a ls /mnt which shows another /mnt/mnt/username/ These folders don't have anything in them. How can reference the path to my external hard drive to the exact file that I need to restore?

The format would have left the drive blank, so those folders are either the result of a mounting error, or were created by the Windows system.

Reconnect the drive to the Windows 7 machine and see what folder it says the files are in. What are the names of the files?
 
When I connect the external hard drive to my windows machine there's no folders. There's just 2 things MBR.img and da0s1a.dump file. Those are the 2 files on my external hard drive without any folders.

When I do the mount of the external hard drive to /mnt I will do the ls /mnt/ command and it will show /mnt/username inside of it. Yes, there's no error messages or any errors spitting out.

I mounted 2 driver to /mnt. I wounder if it still works or do I have to mount the 2 drives in a different folder?

I needed to mount my servers hard drive and need to mount my external hard drive. However I mounted both of them to /mnt. I just want to know if that's the appropriate way to mount the drives? or should I created another folder?
 
hockey97 said:
When I connect the external hard drive to my windows machine there's no folders. There's just 2 things MBR.img and da0s1a.dump file. Those are the 2 files on my external hard drive without any folders.

Excellent--that is exactly how it should be.

When I do the mount of the external hard drive to /mnt I will do the ls /mnt/ command and it will show /mnt/username inside of it. Yes, there's no error messages or any errors spitting out.

I mounted 2 driver to /mnt. I wounder if it still works or do I have to mount the 2 drives in a different folder?

I needed to mount my servers hard drive and need to mount my external hard drive. However I mounted both of them to /mnt. I just want to know if that's the appropriate way to mount the drives? or should I created another folder?

That's the problem. Only a single filesystem can be mounted on a mountpoint. The last one mounted hides the previous ones. If you need more, create a new directory as a mountpoint with mkdir, like #mkdir /mnt2.
 
wblock@ said:
hockey97 said:
When I connect the external hard drive to my windows machine there's no folders. There's just 2 things MBR.img and da0s1a.dump file. Those are the 2 files on my external hard drive without any folders.

Excellent--that is exactly how it should be.

When I do the mount of the external hard drive to /mnt I will do the ls /mnt/ command and it will show /mnt/username inside of it. Yes, there's no error messages or any errors spitting out.

I mounted 2 driver to /mnt. I wounder if it still works or do I have to mount the 2 drives in a different folder?

I needed to mount my servers hard drive and need to mount my external hard drive. However I mounted both of them to /mnt. I just want to know if that's the appropriate way to mount the drives? or should I created another folder?

That's the problem. Only a single filesystem can be mounted on a mountpoint. The last one mounted hides the previous ones. If you need more, create a new directory as a mountpoint with mkdir, like #mkdir /mnt2.

Ya, thanks for letting me know. I had an idea that was the problem. Right now I can mount both. I mount my server the da0 which is my server hard drive. I mount that one on /mnt. I then mount my external hard drive aka the da2 device to /mnt3.

All is going great until I start running the restoring commands.

I ran this command: dd if=/mnt3/mbr.img of=/dev/da0 bs=512 count=1

I was restoring the mbrimage. I then got a result output of this: dd: /dev/da0: operation not permitted

I am guessing it's a permission issue. Maybe need to set the permissions on the new directory I created which was/mnt3?

What do you think I need to do? What permissions do I need to change to be able run that command?
 
Stop for a second. Are you sure you want to write that MBR to da0? Because you may lose everything on it.

Anyway, the thing preventing a write is the GEOM system. It sees a valid disk partition in use, and prevents writes to that. You can use other software to write to it, or turn off the safety, but be very sure you want to erase everything on da0 first.
 
No, never ever use dd(1) to restore an MBR to a disk unless you're 100% sure you know what you're doing. The contents of the MBR block are very complicated and have to be manipulated with tools that are aware of its internal structure. Use gpart(8) with its backup and restore subcommands and the bootblock subcommand to manipulate the partition tables and boot blocks, it's much safer that way.
 
kpa said:
No, never ever use dd(1) to restore an MBR to a disk unless you're 100% sure you know what you're doing. The contents of the MBR block are very complicated and have to be manipulated with tools that are aware of its internal structure. Use gpart(8) with its backup and restore subcommands and the bootblock subcommand to manipulate the partition tables and boot blocks, it's much safer that way.

It's too late for that. I used dd to do all backups. My server right now cannot boot at all. I ran a few commands that output to the screen that the mbr record is corrupted. I took a dump of my hard drive using DD. So, I have to use it to restore it.


I followed advice from other members on here and follow the guides they referred me to go check out.


One was this: http://wiki.iuliann.ro/?FreeBSD/Maintenance/Backup.md
 
wblock@ said:
Stop for a second. Are you sure you want to write that MBR to da0? Because you may lose everything on it.

Anyway, the thing preventing a write is the GEOM system. It sees a valid disk partition in use, and prevents writes to that. You can use other software to write to it, or turn off the safety, but be very sure you want to erase everything on da0 first.

The da0 is the hard drive that my server uses. I need to overwrite the MBR record and restore my server's hard drive using a dump I made a few weeks ago in Jan. I need to do this to get my server back to a previous condition where it worked.

So, how would you prevent the GEOM system from preventing me to do the write to the MBR record?
 
Do not do this routinely. The GEOM safety can be turned off: sysctl kern.geom.debug=16

Keeping in mind that this will erase da0, use dd(1) to write the MBR back to it: dd if=/mnt3/mbr.img of=/dev/da0
It's not necessary to specify a size or block count, the MBR backup should only be 512 bytes anyway.

After writing the MBR, reboot. Boot with an install CD into the Shell or Live CD mode. newfs(8) the filesystems, and use restore(8) to restore from backup.
 
wblock@ said:
Do not do this routinely. The GEOM safety can be turned off: sysctl kern.geom.debug=16

Keeping in mind that this will erase da0, use dd(1) to write the MBR back to it: dd if=/mnt3/mbr.img of=/dev/da0
It's not necessary to specify a size or block count, the MBR backup should only be 512 bytes anyway.

After writing the MBR, reboot. Boot with an install CD into the Shell or Live CD mode. newfs(8) the filesystems, and use restore(8) to restore from backup.


I just tried the command sysctl kern.geom.debug=16. I get the output error stating this exactly: sysctl: unknown oid 'kern.geom.debug=16'. That is what's shown when I ran that command.

Do I need to do something like this?? sysctl kern.geom.debugflags: 0 -> 16
 
wblock@ said:
Do not do this routinely. The GEOM safety can be turned off: sysctl kern.geom.debug=16

Keeping in mind that this will erase da0, use dd(1) to write the MBR back to it: dd if=/mnt3/mbr.img of=/dev/da0
It's not necessary to specify a size or block count, the MBR backup should only be 512 bytes anyway.

After writing the MBR, reboot. Boot with an install CD into the Shell or Live CD mode. newfs(8) the filesystems, and use restore(8) to restore from backup.


Ok, I followed your instructions. I replaced the MBR with the backup version. I then rebooted the computer. Now, I can see in camcontrol devlist the device my servers hard drive being da0 but I no longer see the slices I used to see. I was able to see stuff like da0s1, da0s1a, da0s1b, da0s2etc.. Now, I just see da0.

I don't get the part where you said to do this: "After writing the MBR, reboot. Boot with an install CD into the Shell or Live CD mode. newfs(8) the filesystems, and use restore(8) to restore from backup."

I did reboot the server and now don't have a working server hard drive. I boot into the usb mem stick FreeBSD 8.4 installation image. I tried : newfs /dev/da0 i just seen arrays of numbers streaming on the screen. At the end nothing really happened. I still just see da0.

what do I have to do with newfs? can you give me an example of the command how I should use it?
 
It goes like this:
  1. Partition disk.
  2. Format filesystems.
  3. Restore from backup into filesystems.

That link you posted earlier showed how to do a restore, although it looked a bit suboptimal. You've done the first two steps, now you need to use restore(8) to restore from the backup file you have on the external drive.

Here are my articles on Disk Setup On FreeBSD, which shows partitioning and formatting, and Backup Options For FreeBSD, which shows backup and restore.
 
wblock@ said:
It goes like this:
  1. Partition disk.
  2. Format filesystems.
  3. Restore from backup into filesystems.

That link you posted earlier showed how to do a restore, although it looked a bit suboptimal. You've done the first two steps, now you need to use restore(8) to restore from the backup file you have on the external drive.

Here are my articles on Disk Setup On FreeBSD, which shows partitioning and formatting, and Backup Options For FreeBSD, which shows backup and restore.


I know how to do a restore. The newfs part is there I am confused. I tried newfs /dev/da0. That shows on the screen an array of numbers streaming. It takes about 5 min and eventually stops. I then do a gpart show and it shows da1, da2 with the slices etc. However, I don't see da0. I only see da0 when using command camcontrol devlist Is what I did was what you wanted me to do? which was type the command newfs /dev/da0??

If that was the case then I did that and after I tried to do a restore by doing this : restore -rf /mnt3/da0s1a.dump I get an error message:

"/: write failed, filesystem is full
restore: /tmp/rstdir1388642627: cannot write diectory database: No space left on device
try making space in /tmp/, or set environment variable TMPDIR
to alternate location with more disk space."
 
newfs(8) is for formatting a filesystem. The filesystems are in partitions, not the drive itself. So look at the giant blurry pictures above. Note the da0s1a, da0s1b. That would be a drive (da0) with a slice (s1) with a BSD partition (a).

So: newfs -U /dev/da0s1a or newfs -U /dev/da0s3a.

The restore is running out of space because it is writing to the wrong directory. The article says:
restore puts restored files in the current directory. Remember to cd to the right directory before running restore.
 
wblock@ said:
newfs(8) is for formatting a filesystem. The filesystems are in partitions, not the drive itself. So look at the giant blurry pictures above. Note the da0s1a, da0s1b. That would be a drive (da0) with a slice (s1) with a BSD partition (a).

So: newfs -U /dev/da0s1a or newfs -U /dev/da0s3a.

The restore is running out of space because it is writing to the wrong directory. The article says:
restore puts restored files in the current directory. Remember to cd to the right directory before running restore.

So, where would I cd too? would it be where I mounted the device for example /mnt ?
 
Back
Top