LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-19-2006, 10:07 PM   #1
naihe2010
Member
 
Registered: Oct 2005
Location: China
Distribution: ArchLinux
Posts: 103

Rep: Reputation: 15
How to create a image in Slackware Linux


when I read freenas's source code, I found some codes like this:
Code:
#Creating a 16Mb empty file
dd if=/dev/zero of=image.bin bs=1k count=18432
#use this file as a virtual RAM disk
mdconfig -a -t vnode -f image.bin -u 0
#Create partition on this disk
fdisk -BI -b $BOOTDIR/mbr /dev/md0
#Create label on this disk
bsdlabel -B -w -b $BOOTDIR/boot /dev/md0 auto
bsdlabel md0 >/tmp/label.$$
bsdlabel md0 |
     egrep unused |
     sed "s/c:/a:/" |
     sed "s/unused/4.2BSD/" >>/tmp/label.$$
bsdlabel -R -B md0 /tmp/label.$$
rm -f /tmp/label.$$
#Create filesystem on this disk
newfs -b 8192 -f 1024 -o space -m 0 /dev/md0a
#Mount this disk
mount /dev/md0a $CDROOT
And, I can't "mdconfig" "newfs" "bsdlable" commands. How to do the same thing in Slackware Linux ?
 
Old 11-20-2006, 03:46 PM   #2
osvaldomarques
Member
 
Registered: Jul 2004
Location: Rio de Janeiro - Brazil
Distribution: Conectiva 10 - Conectiva 8 - Slackware 9 - starting with LFS
Posts: 519

Rep: Reputation: 34
Hi naihe2010,

I don't know really what kind of use you want to do with it but, basically, in linux, you create file systems, not partitions. There are several types of fs you can create, ramfs, cramfs, tmpfs, squashfs, isofs but you also can create vfat and ext2.

First you have to create a space to be formatted as your example
Code:
dd if=/dev/zero of=image.dsk bs=1k count=18k
Then you need to format it:
Code:
mke2fs image.dsk # for an ext2 fs
mkisofs image.dsk # for a cd isofs
mksquashfs image.dsk # for a compressed read only fs
mkinitrd image.dsk # for an initial boot ram fs
mkfs.msdos image.dsk # for an msdos fs
Here, it will alert you that image.dsk is not a block device and you confirm for it to proceed.
Now, you only need to mount it with an special mount option:
Code:
mount -o loop image.dsk /mnt/<your-mount-point>
Now you can populate it with your files.

I don't know the purpose of the example you gave on bsd. If it is a boot device, there are other ways to create a bootable media. I can't say the differences because I don't know bsd.

Note. some of these file systems may need special packages, in special squashfs as they are not in the kernel tree yet.
 
Old 11-20-2006, 04:20 PM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
naihe2010,

The address you entered for your website is incorrect/unreachable.
 
Old 11-20-2006, 05:37 PM   #4
naihe2010
Member
 
Registered: Oct 2005
Location: China
Distribution: ArchLinux
Posts: 103

Original Poster
Rep: Reputation: 15
Thank osvaldomarques, that is I wanted.

Thank Bruce Hill.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create custom Linux installation cd from HDD image? chuddy117 Linux - General 0 06-18-2006 02:16 PM
not able to create an image.... os2 Linux - Software 2 08-31-2005 05:26 PM
How to create disk image with Linux? zaoka Linux - Software 3 07-14-2005 03:29 PM
Slackware 10.0 - Direct Boot Fails, Cannot Create Linux Bootdisk Ffi Slackware - Installation 9 07-20-2004 05:48 AM
create windows image from within linux BalaclavaBoB Linux - Software 5 09-08-2003 06:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration