# Backing up from second partition to first one?



## jigzat (Jan 2, 2013)

Hello everyone I installed 9.1R into a second partition but now I have another PC that will contain Windows 8 so I am thinking about moving the FreeBSD partition to the first one and then maybe grow the partition. 

I know I should use dump and restore, but all the instructions I have found say that I should use the same partition. Any advice over this particular situation.


----------



## wblock@ (Jan 2, 2013)

Back up, repartition, restore.  How else can it be done?


----------



## jigzat (Jan 23, 2013)

All I got was that the dump file got de-archived in the backup folder and I got this message 
	
	



```
inode not found on tape expected next file
```
 any ideas what went wrong?


----------



## wblock@ (Jan 23, 2013)

Depends on how you did the backup and how you did the restore.  Please show details.


----------



## jigzat (Jan 23, 2013)

Thanks for bearing up with me. It was my mistake I restore to the wrong folder. I ended up rebooting into single user mode and formating my instalation partition and restoring into it. Although I keep having the same uhh message saying that the inode not found, the inode number appears to match the total size of the dump file. The previous FBSD instalation was located on the third partition and I think the partition scheme was MBR since I had to change the fstab file to ada0p2 from something different like ads0p3 (I dont remember exactly), do you think I might have problems in the future with both things?

PD: it appears that /dev/gpt does not exists, I didn't use labels for the partitions I just choose GPT when formatting during installation, should I add labels? I'm new into these GPT thing.


----------



## wblock@ (Jan 23, 2013)

What were you trying to do?  What partitions are on the disk?  What command line did you use?

Have you read this: Backup Options For FreeBSD?


----------



## max21 (Jan 23, 2013)

Just an idea...

If this is not an remote machine I do it like this every time I add something new which is daily until I'm done.



> Backing up from second partition to first one?


Use a live FreeBSD or Linux CD.  I rather do this with ARCH-2.6.30 because FreeBSD got issues with other UFS elsewhere, than forcing you to use this command and back again which cause confusion or may not work, depending.  Whatever the case, it's was a real trip with 8.2 - 9.0 when I had to do this:


```
sysctl kern.geom.debugflags=16
```

.. Ether learn how to do it with FreeBSD and hope you get it right or simply use ARCH and replace ada0 thing with sda1 and sda2.  Unlike others methods it will never fail!  dd comes straight from your hard drive manufacturer.  This is for FreeBSD partitions only.  You have to ad a split command to save to dos at 3999m or less.

*COMPRESSED*
Backup Partition-1

```
mount /dev/ada0s2 /mnt
cd /mnt
dd if=/dev/ada0s1 bs=64K | gzip -c  > /mnt/freebsd-9.1.img.gz
```

Restore Partition-1

```
mount /dev/ada0s2 /mnt
cd /mnt
gunzip -dc /mnt/freebsd-9.1.img.gz | dd of=/dev/ada0s1  bs=64k
```

If you are dealing with exact same size partitions nothing will ever be as safe and strong as a straight-dd.

*RAW*
Backup Partition-1

```
dd if=/dev/ada0s1 of=/dev/ada0s2 bs=64K
```

Restore Partition-1

```
dd if=/dev/ada0s2 of=/dev/ada0s1 bs=64K
```

Before trying this make a full copy of your hard-drive to another one.

```
dd if=/dev/ada0 of=/dev/ada1 bs=64K
```
or

```
dd if=/dev/sda of=/dev/sdb bs=64K
```
or 
play with other hard drive pieces for practice and time things.


Soon I'll figure out how to do some of this remotely if it's possible and with-out LINUX since we got 9.1, maybe.

Good Luck

btw GPT is for 10,000,000 Terabyte that will take 42 life time to fill up and it robs you of two primary partition that can be used today!


----------



## max21 (Jan 23, 2013)

> .. and then maybe grow the partition.



nevermind, I miss your entire point.  I don't know how to use grow yet.


----------



## wblock@ (Jan 23, 2013)

max21 said:
			
		

> Whatever the case, it's was a real trip with 8.2 - 9.0 when I had to do this:
> 
> 
> ```
> ...



Please don't do that.  It should not be necessary, and if it is, it's a warning that something dangerous is about to take place.

There are times when dd(1) is appropriate, but it is not a good backup program.  I talk about it and other programs in Backup Options For FreeBSD.



> btw GPT is for 10,000,000 Terabyte that will take 42 life time to fill up and it robs you of two primary partition that can be used today!



That's... not exactly right.  GPT on FreeBSD gives 128 partitions, with no need for the ridiculous partitions-within-a-partition setup that is required by MBR.


----------



## jigzat (Jan 23, 2013)

At first I had 3 MBR primary partitions and two extended, (grub Windows 8 FreeBSD Ubuntu and Haiku)  on freeBSD I did a 
	
	



```
dump -0Laf /backup/mydump /
```
. Then reinstalled FBSD and choose GPT with 4 partitions, the FBSD boot manager that takes like 64kb. root /, swap and an extra partition that takes the other half of the HD. Reinstalled FBSD and did  
	
	



```
restore -ruf /backup/mydump.dump
```
. It failed because I thought I was located in the root but I was located in the 
	
	



```
/backup
```
. Then I rebooted into single user mode and made a 
	
	



```
newts -U /dev/ada0p2
```
 mount it on
	
	



```
/mnt
```
 and I mounted 
	
	



```
/dev/ada0p4
```
 into some different folder I think it was called rescue since it was empty I couldn't create a folder into 
	
	



```
/mnt
```
. Then I executed 
	
	



```
restore -ruf /rescue/mydump.dump
```
 and I got the node not found alert, but it finished without any other alert. Then I restart the machine and the boot manager couldn't find a boot partition so I manually specified /dev/ada0p2 and it booted, the after I reboot I got the same message so I checked the fstab file and change the only line to
	
	



```
/dev/ada0p2
```
 and added a new line for the swap partition
	
	



```
/dev/ada0p3
```
.

So far everything is working fine but I am worried about the node not found message and the fact that I change the partition scheme from MBR to GPT maybe there are some other configuration files that had the previous scheme.

That my friends is the resume of my actions ; )

Max21 instructions might help in the future since I already made a backup with dump and wiped out the machine for the new installation.


----------



## wblock@ (Jan 23, 2013)

It really would be nice if restore(8) had a -C option to change to a directory before starting the restore.

The "not found" error could be due to a temporary file, but seeing the actual error would be helpful.

Please don't use dd(1) as a backup.  It is slow.  It copies a lot of data that does not need to be copied.  And really don't use it if you have an SSD, it will ruin the performance of the drive.


----------



## max21 (Jan 24, 2013)

> That's... not exactly right. GPT on FreeBSD gives 128 partitions, with no need for the ridiculous partitions-within-a-partition setup that is required by MBR.
> Reply With Quote



I'm going to get off this thread unless I'm wrong .. We can only install one major OS on GPT, right?  The fight is between Windows, UNIX and BSD.  LINUX can run from anywhere, correct?

MBR can get complicated, but much less than anything else going on right here right now.  MBR is the only way to have all 4 majors OS installed on a single hard drive, leaving plenty of data space to run a home data-center or whatever a single user wish. It's no secrete and it's only fair to include all the facts because not everyone is going to give up MBR for the sake to run any single OS especially as an desktop or workstation.  Would you expect less as an FreeBSD leader?

I'm sorry to disagree with you but dd may be slow but it is flawless and that is what counts.  You use it at home and not at a remote location maybe.


----------



## wblock@ (Jan 24, 2013)

max21 said:
			
		

> I'm going to get off this thread unless I'm wrong .. We can only install one major OS on GPT, right?  The fight is between Windows, UNIX and BSD.  LINUX can run from anywhere, correct?



The question is not clear.  FreeBSD can use GPT, so can Linux and 64-bit Windows 7 and 8.  Older versions of Windows cannot use GPT.

This thread started out with multi-boot with Windows 8 but lately was just talking about a dual-boot with FreeBSD and Linux.



> I'm sorry to disagree with you but dd may be slow but it is flawless and that is what counts.  You use it at home and not at a remote location maybe.



If I failed to make the problems with dd(1) clear in the backup article, please let me know how to improve it.


----------



## jigzat (Jan 25, 2013)

I just realize that I have another dump file and it is bigger the one that I made first is 3Gb and the other one was made by specifing a partition. I'm going to try to restore from that.

I have the feeling that you guys think that I have mÃºltiple OS's on the machine but that was before, right now it only has FBSD


----------

