[Discuss] iscsitarget

Mark Woodward markw at mohawksoft.com
Tue May 1 08:28:27 EDT 2012


On 04/30/2012 11:22 PM, Matthew Kowalski wrote:
> I'm playing with Ubuntu 12.04 LTS and iscsitarget with a Windows 7 initiator.
>
> I was able to create a 20GB file with:
>
> dd if=/dev/zero of=lun1.img bs=1024k count=20000
>
> I can then mount that iSCSI target on my Windows 7 machine and see an
> unallocated disk which I can format and use.  My question is how do I
> expand the lun1.img file to grow the target to say 40GB, etc?
>
> I can do this with a Synology NAS but I can't seem to figure it out
> with Ubuntu.
>
> Any ideas?
>
You can use "truncate" to expand or reduce the size of a file on disk, 
however, if you are playing with iSCSI on Linux as a source for disks, I 
can't stress hard enough that you should investigate LVM. There are some 
very cool tools and facilities that it provides.... For instance:

you can create your volume and share it with LVM. At any point in time 
you can create a snapshot of that disk and basically use it as a second 
copy. (Remembering of course that changes in either the original or the 
copy use up disk space.) There is even a project (opensvc) that uses 
snapshots as a way of backing differential changes. You don't even need 
to know which file system is on it. The difference from snapshot to 
snapshot is all you need.

Imagine this use case: You have a database on the iSCSI disk. You need 
to apply an upgrade but you want to be sure it works. You take a 
snapshot of the disk, work on the snapshot and get to the point where it 
works. You the shut down your database, take another snapshot, apply the 
fix to the main volume. If the fix fails for some reason, you can revert 
it to the snapshot, and try again.

Yes, LVM is very useful. Since you are on Ubuntu 12, you also have some 
more features that older 2.6 kernels don't have.
> Thanks,
> Matt
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://lists.blu.org/mailman/listinfo/discuss




More information about the Discuss mailing list