From owner-freebsd-questions@FreeBSD.ORG Wed Jun 23 10:54:52 2010 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 755B8106566B for ; Wed, 23 Jun 2010 10:54:52 +0000 (UTC) (envelope-from vince@unsane.co.uk) Received: from unsane.co.uk (unsane-pt.tunnel.tserv5.lon1.ipv6.he.net [IPv6:2001:470:1f08:110::2]) by mx1.freebsd.org (Postfix) with ESMTP id B20028FC08 for ; Wed, 23 Jun 2010 10:54:51 +0000 (UTC) Received: from vhoffman.lon.namesco.net (2.67-246-213.ippool.namesco.net [213.246.67.2]) (authenticated bits=0) by unsane.co.uk (8.14.4/8.14.4) with ESMTP id o5NAsnpx029610 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Wed, 23 Jun 2010 11:54:50 +0100 (BST) (envelope-from vince@unsane.co.uk) Message-ID: <4C21E7F8.2050802@unsane.co.uk> Date: Wed, 23 Jun 2010 11:54:48 +0100 From: Vincent Hoffman User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <4C21E163.70003@comclark.com> In-Reply-To: <4C21E163.70003@comclark.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: sparse image X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Jun 2010 10:54:52 -0000 On 23/06/2010 11:26, Aiza wrote: > Is there an equivalent of the MAC sparseimage on FreeBSD? If you mean you would like to make a sparse file and attach it using mdconfg then dd if=/dev/zero of=/path/to/outfile bs=1M seek=1024 count=0 This will give you a sparse file that reports a gig in size, but only uses whats actually in use. you can then use mdconfig(8) to allow this to be partitioned formatted and mounted. Example below. see also http://www.freebsd.org/doc/en/books/handbook/disks-virtual.html although that example doesnt use a spare file. [root@ostracod /scratch/media]# dd if=/dev/zero of=foo.img bs=1M seek=1024 count=0 0+0 records in 0+0 records out 0 bytes transferred in 0.000066 secs (0 bytes/sec) [root@ostracod /scratch/media]# ls -lh foo.img -rw-r--r-- 1 root wheel 1.0G Jun 23 11:45 foo.img [root@ostracod /scratch/media]# du -h foo.img 48K foo.img [root@ostracod /scratch/media]# mdconfig -a -t vnode -f foo.img md0 [root@ostracod /scratch/media]# gpart create -s gpt md0 md0 created [root@ostracod /scratch/media]# gpart add -t freebsd-ufs md0 md0p1 added [root@ostracod /scratch/media]# newfs /dev/md0p1 /dev/md0p1: 1024.0MB (2097084 sectors) block size 16384, fragment size 2048 using 6 cylinder groups of 183.72MB, 11758 blks, 23552 inodes. super-block backups (for fsck -b #) at: 160, 376416, 752672, 1128928, 1505184, 1881440 [root@ostracod /scratch/media]# !ls ls -lh foo.img -rw-r--r-- 1 root wheel 1.0G Jun 23 11:46 foo.img [root@ostracod /scratch/media]# !du du -h foo.img 736K foo.img [root@ostracod /scratch/media]# mount /dev/md0p1 /mnt/foo/ [root@ostracod /scratch/media]# df -h | grep foo /dev/md0p1 989M 4.0K 910M 0% /mnt/foo [root@ostracod /scratch/media]# Hope this is helpful. Vince > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"