sysinstall creates corrupt filesystems after repartitioning
Jeremy Chadwick
koitsu at FreeBSD.org
Fri Mar 2 21:25:08 UTC 2007
On Fri, Mar 02, 2007 at 05:00:24PM -0000, Steven Hartland wrote:
> No problem if you have the resources / time to test this now
> thats great.
>
> Here's the steps I used, if you have any questions just shout:
> 1. Boot a normal 6.2 install
Done. Booted CD image #1, did a standard install, chose Minimal
as the installation type. Also chose to install the FreeBSD boot
manager and the like.
> 2. dump /usr to remote location
Done. From the machine going to act as an NFS server, I did:
icarus# ssh -c blowfish root at 192.168.1.193 "/sbin/dump -0 -f- /usr" | dd of=usr.dump bs=65536
DUMP: WARNING: should use -L when dumping live read-write filesystems!
DUMP: Date of this level 0 dump: Fri Mar 2 12:49:29 2007
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/ad0s1f (/usr) to standard output
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 106124 tape blocks.
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: DUMP: 110621 tape blocks
DUMP: finished in 35 seconds, throughput 3160 KBytes/sec
DUMP: DUMP IS DONE
1+13937 records in
1+13937 records out
113274880 bytes transferred in 18.691292 secs (6060302 bytes/sec)
icarus# ls -l usr.dump
-rw-r--r-- 1 root wheel 113274880 Mar 2 12:55 usr.dump
> 3. restore said dump to a empty directory on the remote machine
Done:
icarus# restore -x -f usr.dump
You have not read any tapes yet.
If you are extracting just a few files, start with the last volume
and work towards the first; restore can quickly skip tapes that
have no further files to extract. Otherwise, begin with volume 1.
Specify next volume #: 1
set owner/mode for '.'? [yn] n
icarus# ls -l
total 110750
drwxrwxr-x 2 root operator 512 Mar 2 04:40 .snap
drwxr-xr-x 2 root wheel 7168 Mar 2 04:40 bin
drwxr-xr-x 2 root wheel 512 Mar 2 04:40 compat
drwxr-xr-x 2 root wheel 512 Mar 2 04:40 games
drwxr-xr-x 47 root wheel 4608 Mar 2 04:40 include
drwxr-xr-x 4 root wheel 7168 Mar 2 04:40 lib
drwxr-xr-x 5 root wheel 512 Mar 2 04:40 libdata
drwxr-xr-x 5 root wheel 1536 Mar 2 04:40 libexec
drwxr-xr-x 2 root wheel 512 Jan 11 23:38 local
drwxr-xr-x 2 root wheel 512 Mar 2 04:40 obj
drwxr-xr-x 2 root wheel 5120 Mar 2 04:40 sbin
drwxr-xr-x 27 root wheel 512 Mar 2 04:40 share
drwxr-xr-x 2 root wheel 512 Jan 11 23:38 src
-rw-r--r-- 1 root wheel 113274880 Mar 2 12:55 usr.dump
icarus# ls -ld .
drwxr-xr-x 15 root wheel 512 Mar 2 12:58 .
> 4. share this directory over nfs to the test machine
Done. You know the routine to get NFS to work... ;) My exports:
/storage -alldirs -maproot=root -network 192.168.1.0 -mask 255.255.255.0
Verified to be working on test box via:
mount -t nfs icarus.home.lan:/storage/nfs /mnt
ls -l /mnt
umount /mnt
Worked OK.
> 5. edit /etc/fstab to use the nfs /usr instead of the ufs /usr
Done. The test box's /etc/fstab now contains:
icarus.home.lan:/storage/nfs /usr nfs rw 0 0
# old /usr, local to filesystem
# /dev/ad0s1f /usr nfs rw 2 2
> 6. reboot
Done. Rebooted test box. Box came up with an NFS mounted /usr:
# df -k
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 507630 36838 430182 8% /
devfs 1 1 0 100% /dev
/dev/ad0s1e 507630 12 467008 0% /tmp
/dev/ad0s1d 1506190 234 1385462 0% /var
icarus.home.lan:/storage/nfs 473015558 120242684 314931630 28% /usr
> 7. Enable mbr changes on live fs: sysctl kern.geom.debugflags=16
Done.
# sysctl kern.geom.debugflags=16
kern.geom.debugflags: 0 -> 16
> 8. run sysinstall
> 8.1 delete /dev/(da|ad)0s1f ( the /usr partition )
Done. Prior to deletion:
ad0s1f <none> 4645MB *
> 8.2 create a smaller /usr in the space cleared
> 8.3 create /data with the remaining space
Done:
ad0s1f /usr 3072MB UFS2+S Y
ad0s1g /data 1573MB UFS2+S Y
> 8.4 Write the changes
Done. However, there were errors:
......................... Message .........................
.Unable to add /dev/ad0s1b as a swap device: Device busy .
..................................................(100%)...
. [ OK ] .
.................[ Press enter or space ]..................
............................. Message .............................
.Error mounting /dev/ad0s1g on /data : No such file or directory .
..........................................................(100%)...
. [ OK ] .
.....................[ Press enter or space ]......................
> 9. quit sysinstall
Done. Did a df -k just before step 10, just to be sure:
# df -k
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 507630 36840 430180 8% /
devfs 1 1 0 100% /dev
/dev/ad0s1e 507630 12 467008 0% /tmp
/dev/ad0s1d 1506190 234 1385462 0% /var
icarus.home.lan:/storage/nfs 473015558 120242684 314931630 28% /usr
/dev/ad0s1f 4603338 4 4235068 0% /usr
> 10. umount -f /usr ( to restore the nfs version )
I did this via umount -f /dev/ad0s1f instead of umount /usr, since
I wasn't sure if the NFS mount /usr would get removed or the local
filesystem /usr:
# umount -f /dev/ad0s1f
# df -k
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0s1a 507630 36840 430180 8% /
devfs 1 1 0 100% /dev
/dev/ad0s1e 507630 12 467008 0% /tmp
/dev/ad0s1d 1506190 234 1385462 0% /var
icarus.home.lan:/storage/nfs 473015558 120242684 314931630 28% /usr
> 11. umount /data
Can't, because it didn't get created.
> 12. fsck /dev/(da|ad)0s1(f|g) both will be corrupt.
Doesn't appear to happen for me:
# fsck /dev/ad0s1f
** /dev/ad0s1f
** Last Mounted on /usr
** Phase 1 - Check Blocks and Sizes
** Phase 2 - Check Pathnames
** Phase 3 - Check Connectivity
** Phase 4 - Check Reference Counts
** Phase 5 - Check Cyl groups
2 files, 2 used, 2301667 free (27 frags, 287705 blocks, 0.0% fragmentation)
Is there something I'm missing?
--
| Jeremy Chadwick jdc at parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, USA |
| Making life hard for others since 1977. PGP: 4BD6C0CB |
More information about the freebsd-stable
mailing list