Hi. I need more space on my domU server, so i create a file image to attach it to the domU. But when i load that image in the domU, show a size very different to the create. I create the file with this command dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 count=30720 (The idea is create an image disk with 30GB, but when i check the disk on the domU show 64GB.) attach the image to the domU xm block-attach SRV03 tap:aio:/xen/domains/SRV03/opt-disk.img sdb1 w so i access to domU and create the filesystem. mkfs.ext3 /dev/sdb1 but when search the domU disk display a diferent size Disk /dev/sdb1: 64.4 GB, 64424509440 bytes 255 heads, 63 sectors/track, 7832 cylinders Units = cilinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x00000000 If i mount the file image on the dom0, shows 60GB. CONTANIER:/xen/domains/SRV03# mount -o loop opt-disk.img /mnt df -h /xen/domains/SRV03/opt-disk.img 60G 180M 56G 1% /mnt But if i check the disk file size with du, show the expected size CONTANIER:/xen/domains/SRV03# du -sh opt-disk.img 31G opt-disk.img Why display that size? is that a bug? or some bad parameter when create the image disk. Im using xen 3.2 on debian Lenny Thanks and regards. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hi,> I create the file with this command > > dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 > count=30720Why are you using the seek= parameter? This is the cause of your "problem" (actually, everything is happening in the way you want, but this isn''t needed for that). Regards Ervin _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Ervin Novak wrote:> > I create the file with this command >> > > dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 >> count=30720 > >Why are you using the seek= parameter? This is the cause of your >"problem" (actually, everything is happening in the way you want, but >this isn''t needed for that).It''s a standard technique for creating a sparse file. The problem is specifying count as well as seek - so it''s seeking over 30G (creating a sparse file), and then adding 30G of zeros. The command should be : dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30719 count=1 This will seek to 1M under 30G (( 30 * 1024 ) - 1 ), and then write 1M of zeros. -- Simon Hobson Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed author Gladys Hobson. Novels - poetry - short stories - ideal as Christmas stocking fillers. Some available as e-books. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Sun, Mar 20, 2011 at 5:55 AM, Simon Hobson <linux@thehobsons.co.uk> wrote:>> > I create the file with this command >>> >>> dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 >>> count=30720> The command should be : > dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30719 > count=1 > > This will seek to 1M under 30G (( 30 * 1024 ) - 1 ), and then write 1M of > zeros.... or simply dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 count=0 that way no actual write needs to occur, but you get the same result. -- Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha wrote:>... or simply > >dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 count=0 > >that way no actual write needs to occur, but you get the same result.I''d never thought of trying a count of zero. On the other hand, what does this do for I/O performance long term ? Does a sparse image that''s grown piecemeal over time perform better/worse/no different to an image that was written in one go ? -- Simon Hobson Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed author Gladys Hobson. Novels - poetry - short stories - ideal as Christmas stocking fillers. Some available as e-books. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Sun, Mar 20, 2011 at 5:01 PM, Simon Hobson <linux@thehobsons.co.uk> wrote:> Fajar A. Nugraha wrote: > >> ... or simply >> >> dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 >> count=0 >> >> that way no actual write needs to occur, but you get the same result. > > I''d never thought of trying a count of zero. > > On the other hand, what does this do for I/O performance long term ? Does a > sparse image that''s grown piecemeal over time perform better/worse/no > different to an image that was written in one go ?It shouldn''t matter much how many times you extend it (as long as the fs resizer can cope with it). What matters more is whether the file is preallocated or sparse, with sparse file generally having lower performance due to fragmentation. -- Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
2011/3/20 Fajar A. Nugraha <list@fajar.net>> On Sun, Mar 20, 2011 at 5:01 PM, Simon Hobson <linux@thehobsons.co.uk> > wrote: > > Fajar A. Nugraha wrote: > > > >> ... or simply > >> > >> dd if=/dev/zero of=/xen/domains/SRV03/opt-disk.img bs=1024k seek=30720 > >> count=0 > >> > >> that way no actual write needs to occur, but you get the same result. > > > > I''d never thought of trying a count of zero. > > > > On the other hand, what does this do for I/O performance long term ? Does > a > > sparse image that''s grown piecemeal over time perform better/worse/no > > different to an image that was written in one go ? > > It shouldn''t matter much how many times you extend it (as long as the > fs resizer can cope with it). What matters more is whether the file is > preallocated or sparse, with sparse file generally having lower > performance due to fragmentation. > > -- > Fajar > > _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-users >Well, I use the same command without the seek parameter, and now the image disk is displayed correctly. And i agree too, a sparse image have low performance. Thanks and regards. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users