All we need are a software such as VMWare or VirtualBox or whatever you prefer, and a guest OS which can access to Ext file system. I choose VirtualBox - because it absolutely free for non-commercial user for virtualization solution, and Ubuntu server 10.04 32bit edition - same reasons. Moreover, I'm familiar with them. The idea is using guest OS to access to Ext partition and share as network storage.
( I did my system on Windows 7 64 bit as host OS to access my /home partition)
1. Download Virtual Box (Windows version, of course) and Ubuntu Server if you haven't already had. Install Virtual Box and needed packages.
2. Open command prompt, change to Virtual Box installed folder and run this command:
VBoxManage internalcommands listpartitions -rawdisk \\.\PhysicalDriveXThis above command will enumerate all your partitions and their type. Please replace "X" by your drive number. In my case, it is "0". The result should be similar this:
In my case, the Ext3 partitions were number 6 and 7 (0x83 type), my /home partition were number 6 (because I remembered all capacity of my partitions :p ). These information will be used later.
3. Open VirtualBox and create a new virtual machine. Don't need to set high specification for this. Remember to set network to "Bridge", insert the Ubuntu Server iso file to guest machine cd-rom. Power up and install Ubuntu Server to our guest.
(When it ask about "Continue without default router...", just choose Yes. When it ask about name server, leave it blank. When it ask about which kind of server we use, choose Samba server).
4. Now we need to create disk image which point to our Ext3 partition. Open command prompt of Windows host, change to VirtualBox installed folder and run command below:
VBoxManage internalcommands createrawvmdk -filename sda6.vmdk -rawdisk \\.\PhysicalDrive0 -partitions 6Remember to replace sd6.vmdk, PhysicalDrive0, 6 to match your system (number that we got in step 2), but the filename must be .vmdk extension.
5. Shutdown guest machine and add above disk image to guest.
Click to button Add Attachment, select Add Hard disk and choose above disk image in step 5.
6. Boot up virtual machine and set something to share our Ext partition with host:
a. Create a share folder to mount our Ext partition:
$sudo mkdir /Ext_partitionb. Edit your fstab to auto-mount the partition at every startup:
$sudo chmod 777 /Ext_partition
$sudo vi /etc/fstabadd the following
/dev/sdXY /Ext_partition ext3 relatime,,ro,errors=remount-ro 0 1(where X should be a,b,xn-- depending on hdd number, and Y should 1,2,xn-- depending on partition number - in my case, because the disk image we added later - guest server recognize it as second HDD, so it is sdb6).
c. Edit samba configuration:
sudo vi /etc/samba/smb.confchange workgroup to be the same as windows one, and uncomment the security line:
workgroup = yourworkgroupadd this to the end:
security = user
[Ext3]now add and enable this user to samba
comment = The Ext partition
path = /Ext_partition
browseable = yes
writeable = yes
valid users = tutorial
sudo useradd tutorial --shell /bin/falserestart samba
sudo smbpasswd -a tutorial
sudo smbpasswd -e tutorial
sudo /etc/init.d/samba restart
7. Done. Type this \\<IP of server> to Start > Search programs and files. Take a coffee and enjoy it ;)
Hope it useful.
No comments:
Post a Comment