Virtual disk to create and partition | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Virtual disk to create and partition

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 05-08-2010
Guccio's Avatar
Guccio Guccio is offline
Registered User
 
Join Date: Apr 2010
Last Activity: 3 October 2010, 6:42 AM EDT
Posts: 16
Thanks: 4
Thanked 0 Times in 0 Posts
Virtual disk to create and partition

I have to do this exercise:
  • Create a virtual disk
  • Partition this disk
  • Create File system
  • Mount File System
I'm using Minix (which runs by Qemu as guest machine) on Linux (Host)

Is there anybody who knows how to solve first three point?
Thanks
Sponsored Links
    #2  
Old 05-08-2010
pseudocoder's Avatar
pseudocoder pseudocoder is offline
Registered User
 
Join Date: Sep 2007
Last Activity: 17 February 2012, 6:42 AM EST
Location: /home/sea
Posts: 602
Thanks: 40
Thanked 83 Times in 81 Posts
Debian

I guess you want to do that to get some more space for Minix (the Qemu guest machine)?
Do you have the Qemu Launcher installed? If so, then it's gonna be a pretty easy task.
I've successfully tested following steps with DSL as Qemu guest on FreeBSD host:

1. Creating the actual virtual disk on host:
Open a shell and go to a directory, where you want to create the virtual disk and type following command (In my case I wanted the virtual disk to be 1 GB "large")

Code:
qemu-img create virtdisc.img 1G

2. Open the Qemu Launcher, click on the button "Open" next to "Hard disk 1" entry, browse to the directory which is containing the image you have previously created, select the image and click the "Open" button.

3. Launch your Guest OS.

4. Now you need to check if the new created disk is recognized by your Guest OS. Run
Code:
dmesg | grep hd

to know that. If you're lucky, you will find a couple lines similar to these:

Code:
<4>hdb: attached ide-disk driver
<6>hdb: 2097152 sectors (1074 MB) w/256KiB Cache, CHS=130/255/63
<6>Partition check:
<6> hdb: unknown partition table

5. Right now you need to create a partition:
Code:
cfdisk -z /dev/hdb

The usage of this tool is pretty self-explanatory.

6. Reboot Guest OS

7. Check if the partition was successfully created, use "dmesg | grep hd" again. This time the hdb line will look slightly different:

Code:
<6> hdb: hdb1

Looks good ^^

8. It's time to format the partition:
Code:
mkfs /dev/hdb1

9. Mount your new virtual disk:
Code:
mount /dev/hdb1 /mnt/hdb1

10. Enjoy
Code:
df -h

The Following User Says Thank You to pseudocoder For This Useful Post:
Guccio (05-10-2010)
Sponsored Links
    #3  
Old 05-09-2010
Guccio's Avatar
Guccio Guccio is offline
Registered User
 
Join Date: Apr 2010
Last Activity: 3 October 2010, 6:42 AM EDT
Posts: 16
Thanks: 4
Thanked 0 Times in 0 Posts
dmesg doesn't exist in my version of minix (R3.1.6)

---------- Post updated at 06:30 AM ---------- Previous update was at 05:18 AM ----------

This is the settings of Qemu launcher. Is it right?



Minix hasn't the command dmesg, How can I find virtual image in /dev/ ?

Last edited by Guccio; 05-09-2010 at 11:15 AM..
    #4  
Old 05-09-2010
pseudocoder's Avatar
pseudocoder pseudocoder is offline
Registered User
 
Join Date: Sep 2007
Last Activity: 17 February 2012, 6:42 AM EST
Location: /home/sea
Posts: 602
Thanks: 40
Thanked 83 Times in 81 Posts
Quote:
Originally Posted by Guccio View Post
dmesg doesn't exist in my version of minix (R3.1.6)
Try
Code:
cat /var/log/dmesg

.
Quote:
Originally Posted by Guccio View Post
This is the settings of Qemu launcher. Is it right?
The Following User Says Thank You to pseudocoder For This Useful Post:
Guccio (05-10-2010)
Sponsored Links
    #5  
Old 05-10-2010
Guccio's Avatar
Guccio Guccio is offline
Registered User
 
Join Date: Apr 2010
Last Activity: 3 October 2010, 6:42 AM EDT
Posts: 16
Thanks: 4
Thanked 0 Times in 0 Posts
[Solved]

/var/log/ is empty, but now I know

You can find Virtual disk in this order (in Minix, in this case, but similar for other):

Hard Disk 0: /dev/c0d0
Hard Disk 1: /dev/c0d1
Hard Disk 2: /dev/c0d2
.............. : ......

Pseudocoder thank you for your help
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
create new partition semaphore UNIX for Dummies Questions & Answers 2 11-09-2008 10:09 PM
How to Create New Partition Ackers Solaris 11 07-27-2008 06:31 PM
How To Create Partition In Fc5 mani_um Filesystems, Disks and Memory 1 06-11-2007 11:25 PM
[help] create partition for /data bucci Solaris 2 10-09-2006 01:21 AM
Am I running in a virtual partition Midcain HP-UX 1 11-30-2005 06:49 PM



All times are GMT -4. The time now is 07:15 PM.