# dumped /usr and restored



## tom-pele (Aug 26, 2010)

Hi

I began to lack space on /usr and saw this :
freebsd.org/doc/en_US.ISO8859-1/books/faq/book.html#NEW-HUGE-DISK

From there I got inspired to restore /usr on a new slice
(did umount ntfs and made newfs)

```
...
#Cd /mnt
#Dump 0af /usr restore -  
...
```
But maybe I missed something ; it only wants to go to single mode (?) It probably missing all /usr or can't load it from restored /mnt and my question is : can I get back to use the old /usr and how (back to lack of space) or what can I do to finish the dump/restore process (new stage setup) ?

...:...
Now it tries to mount root but , but this I didn't change : /dev/ad6s2a. Only made room to /mnt with newfs to /dev/ad6s1

Thanks


----------



## wblock@ (Aug 26, 2010)

Your /etc/fstab is probably still referring to the old /usr.

But it's hard to tell exactly what you did.


----------



## tom-pele (Aug 26, 2010)

*only root is mounted..*

Apparently root is only mounted, (and /dev)...
df -h says :

```
/dev/ad6s2a ...
```
And devfs.

Woops , what I did doo , ? ok it's only a pc , no data..


----------



## tom-pele (Aug 26, 2010)

*/dev contains ad6s1 and ad6s2..*

Luckily I can access /dev , so I can manually mount ..
/etc/fstab


----------



## wblock@ (Aug 26, 2010)

What device did you mount for the new /usr?


----------



## tom-pele (Aug 26, 2010)

*back in old system ..*



			
				wblock said:
			
		

> Your /etc/fstab is probably still referring to the old /usr.
> 
> But it's hard to tell exactly what you did.



Luckily I could access /etc/fstab and remark the new slice1,
And next time try better planning and better execution (understanding)
On whats going on...

Luckily nothing happened, but lesson learned  ...


----------



## tom-pele (Aug 26, 2010)

wblock said:
			
		

> What device did you mount for the new /usr?



fstab looks like this now : 

```
# Device		Mountpoint	FStype	Options		Dump	Pass#
/dev/ad6s2b		none		swap	sw		0	0
/dev/ad6s2a		/		ufs	rw		1	1
/dev/ad6s2e		/tmp		ufs	rw		2	2
/dev/ad6s2f		/usr		ufs	rw		2	2
/dev/ad6s2d		/var		ufs	rw		2	2
#/dev/ad6s1		/mnt		usf	rw		2	2
#/dev/acd0		/cdrom		cd9660	ro,noauto	0	0
# linproc   /usr/compat/linux/proc    linprocfs    rw   0    0
proc			/proc		procfs	rw
```

i removed af NTFS partitions on former slice 1 and made maybe not well executed newfs
and mount as temporarily /mnt

later on made dump and restored /usr to /dev/ad6s1 ...

like this :


```
# newfs /dev/ad6s1
# mount /dev/ad6s1 /mnt
# cd /mnt
# dump 0af - /usr | restore rf -
```
But there where no problem with the dump and restore part, not at all...


----------



## graudeejs (Aug 26, 2010)

http://forums.freebsd.org/showthread.php?t=185


----------



## wblock@ (Aug 26, 2010)

tom-pele said:
			
		

> i removed af NTFS partitions on former slice 1 and made maybe not well executed newfs
> and mount as temporarily /mnt
> 
> later on made dump and restored /usr to /dev/ad6s1 ...
> ...



You still have /etc/fstab saying /usr is ad6s2f.  That should be changed to ad6s1:

```
/dev/ad6s1		/usr		ufs	rw		2	2
```

(Your system still should have come up with the old /usr mounted.  Since it didn't, there may be something else wrong, like newfs-ing the wrong place.)


----------



## tom-pele (Sep 10, 2010)

*checked with sysinstall*

Hi

Sorry not for answering quickly enough, waited for infration to expire.
I'm am still struggling with basic stuff 
Regarding newfs it seems like it never happened, when i check with sysinstall and fdisk
it said there was still a ntfs slice :


```
metabeta# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad6s2a    496M    394M     62M    86%    /
devfs          1.0K    1.0K      0B   100%    /dev
/dev/ad6s2e    496M     86K    456M     0%    /tmp
/dev/ad6s2f     16G     10G    4.3G    71%    /usr
/dev/ad6s2d    3.9G    2.0G    1.5G    57%    /var
procfs         4.0K    4.0K      0B   100%    /proc
```



```
metabeta# fdisk
******* Working on device /dev/ad6 *******
parameters extracted from in-core disklabel are:
cylinders=620181 heads=16 sectors/track=63 (1008 blks/cyl)

Figures below won't work with BIOS for partitions not in cyl 1
parameters to be used for BIOS calculations are:
cylinders=620181 heads=16 sectors/track=63 (1008 blks/cyl)

Media sector size is 512
Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 1 is:
sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
    start 2048, size 571906040 (279250 Meg), flag 0
	beg: cyl 2/ head 0/ sector 33;
	end: cyl 1023/ head 2/ sector 10
The data for partition 2 is:
sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
    start 571908088, size 53234360 (25993 Meg), flag 80 (active)
	beg: cyl 1023/ head 255/ sector 63;
	end: cyl 1023/ head 15/ sector 63
The data for partition 3 is:
<UNUSED>
The data for partition 4 is:
<UNUSED>
```

when trying to delete slice ad6s1 with sysinstall  it says, :

```
Disk name:      ad6                                    FDISK Partition Editor
DISK Geometry:  620181 cyls/16 heads/63 sectors = 625142448 sectors (305245MB)

Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags

         0       2048       2047        -     12     unused        0          
      2048  571906040  571908087    ad6s1      4 NTFS/HPFS/QNX        7
 571908088   53234360  625142447    ad6s2      8    freebsd      165






The following commands are supported (in upper or lower case):

A = Use Entire Disk   G = set Drive Geometry   C = Create Slice
D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Expert m.
T = Change Type       U = Undo All Changes     W = Write Changes  Q = Finish


Use F1 or ? to get more help, arrow keys to select.
```


```
chunk 'ad6s2' [571908088..625142447] does not start on a track boundary
```

and i can't delete the slice ad6s1 and I can only cancel and quit.

Thanks for reading this, 
meanwhile i've managed to free up space by 
	
	



```
portsclean -DD
```

any advice is appreciated for deleting ad6s1 properly 

Have a nice day


----------



## wblock@ (Sep 10, 2010)

tom-pele said:
			
		

> Hi
> 
> Sorry not for answering quickly enough, waited for infration to expire.
> I'm am still struggling with basic stuff
> ...



That's still using ad6s2f for /usr.  If you really newfs-ed the whole first slice, that would be what you mount as /usr: /dev/ad0s1.



> ```
> Information from DOS bootblock is:
> The data for partition 1 is:
> sysid 7 (0x07),(NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX)
> ...



You're dealing with two different things.  newfs(8) will create a filesystem wherever you tell it.  That's all it does.  The MBR is where the slice type is defined, and newfs won't touch that, because it doesn't care about the MBR.

fdisk(8) can change the MBR, although that's something I would not touch without a full backup (meaning dump files saved to another device for /, /var, and /usr).  Besides, it might not matter.  If only the FreeBSD slice is marked bootable (active), probably nothing will care about the type of the first slice.

Really, the right way to fix this is to dump /, /var, and /usr to another drive.  Then redo the slices on this drive and restore from the backup.  After the restore, but before rebooting, edit /etc/fstab to match the new slice/partition layout.  Otherwise, you'll have to do the single-user/remount writable/edit fstab dance of death.


----------

