tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: creating FFS2 file-system with makefs on linux



(I am answering both Lloyd and Christos here, as I couldn't get a grasp on the second email, and to keep the Message-ID dance)

The workaround that I use is to create a small image, write it to large partition, and then use /etc/rc.d/resize_root when booting the image.

Thanks Lloyd.  So here's how I created and increased the size of the image:

	tools/bin/nbmakefs -t ffs -o v=2,o=time -s 2g netbsd.ffs2 tree/
	dd if=/dev/zero bs=1G count=6 >> netbsd.ffs2
        fallocate --dig-holes netbsd.ffs2

I then tried adding this to guest image's rc.conf

resize_root=yes

that but did not have success with it. Disklabel is already fine so I didn't need `resize_disklabel=yes`. I could read this at boot time:

	Resizing /

but the fs was still about 2GB, and worse, it seems to be corrupted already at next boot:

Starting root file system check:
/dev/rxbd0a: BAD SUPER BLOCK: VALUES IN SUPER BLOCK DISAGREE WITH THOSE IN FIRST ALTERNATE

/dev/rxbd0a: UNEXPECTED INCONSISTENCY; RUN fsck_ffs MANUALLY.
Automatic file system check failed; help!
ERROR: ABORTING BOOT (sending SIGTERM to parent)!
[1]   Terminated              rc_real_work "${@}" 2>&1 |
      Done(1)                 rc_postprocess

Note the same thing happens even if I don't make the image sparse.

I also tried to do it manually in single user mode:

	resize_ffs /dev/xbd0a

but that also fails:

	resize_ffs: Can't open `/dev/xbd0a': Device busy

although the root file-system is mounted ro:

	root_device on / type ffs (read-only, local)

so I really don't know what is locking it.

Perhaps we are not building the tools with:

-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

So it can't handle more than 2G?

Thanks Christos. I tried that also by different means (I was not sure where to add those flags)

/etc/mk.conf

COPTS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

/etc/mk.conf

CPUFLAGS+=-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

tools/makefs/Makefile

HOST_CPPFLAGS+= -I. -I${TOOLDIR}/include/nbinclude -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64

but any of those attempts changed anything here:

# /usr/src/usr/tools/bin/nbmakefs -t ffs -o v=2,o=time -s 3g netbsd.ffs2 tree/
Calculated size of `netbsd.ffs2': 3221225472 bytes, 21247 inodes
nbmakefs: ffs_wtfs: seek error for sector 6291455: Invalid argument


Home | Main Index | Thread Index | Old Index