Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
There is less than 2 hours left to vote in the 2015 LinuxQuestions.org Members Choice Awards. Click here to go to the polls. Vote now and make sure your voice is heard!
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I had a kit that has a SCSI device built-in and it starts up in DOS. I also attach a hard disk (hda) to it. My goal is to deploy a linux operating system to the kit.
So I proposed to use a bootable USB for Linux and it will load the kernel I have built. My idea is to format a small part of the hard disk which can be seen as a drive in DOS (e.g. /dev/hda1 as C drive) and the remaining will be formatted as ext3 (e.g. /dev/hda2). When the kit starts and finds A drive for the SCSI, the autoexec.bat in A drive will contain the instructions to change directory to C drive and start the grub for the Linux operating system.
I am a newbie in Linux. I roughly knew the concepts but had no idea how to write my kernel scripts to achieve the goal. How should I write my scripts? e.g.
1. fdisk /dev/hda to create /dev/hda1 and /dev/hda2
2. mkfs.ext3 /dev/hda2 to format the hard disk for linux
3. mkdosfs -F xx /dev/hda1 for Windows?
4. What's next?
While I don't know what you mean by kernel scripts, you have everything ok there. You can skip #2, as when you install Linux it will allow you to do so in the installer, so save yourself the extra work there.
Also, you can omit "-F xx" in #3 if you choose. mkfs.msdos will choose which FAT size to use based on the size of the partition, and I would let it do so, unless you have a specific need (I noticed a mention of DOS, but do not know what specific DOS and what it supports). If you do need to use a specific FAT size, keep that in mind when you set the size of the partition.
While I don't know what you mean by kernel scripts, you have everything ok there.
When you use a bootable USB for linux like UNetbootin, syslinux.cfg will tell what image to load. I have written some scripts to instruct how to format the hard disk at startup, build the kernel image with those scripts, and then put the kernel image into the USB drive (like initramfs).
Originally Posted by goumba
#4. Install your OS(es) of choice.
Unfortunately, my kit is an embedded device which uses busybox as the Linux operating system. When the kit starts, it will decompress the kernel image from the USB drive and load the scripts I have written. The scripts aim to format /dev/hda1 that is recognised from DOS and put the grub into it. So when I unplug the USB drive and reboot the kit, /dev/hda1 will be seen as C drive and so the autoexec.bat in the SCSI can find the grub in the C drive.
Last edited by chesschi; 03-04-2013 at 07:28 AM.
Reason: Add greeting :)
mkdosfs is used to create an MS-DOS file system under Linux on a device (usually a disk partition). device is the special file corresponding to the
device (e.g /dev/hdXX). block-count is the number of blocks on the device. If omitted, mkdosfs automatically determines the file system size.
-a Normally, for any filesystem except very small ones, mkdosfs will align all the data structures to cluster size, to make sure that as long as
the partition is properly aligned, so will all the data structures in the filesystem. This option disables alignment; this may provide a hand-
ful of additional clusters of storage at the expense of a significant performance degradation on RAIDs, flash media or large-sector hard disks.
-A Use Atari variation of the MS-DOS file system. This is default if mkdosfs is run on an Atari, then this option turns off Atari format. There are
some differences when using Atari format: If not directed otherwise by the user, mkdosfs will always use 2 sectors per cluster, since GEMDOS
doesn't like other values very much. It will also obey the maximum number of sectors GEMDOS can handle. Larger file systems are managed by
raising the logical sector size. Under Atari format, an Atari-compatible serial number for the file system is generated, and a 12 bit FAT is
used only for file systems that have one of the usual floppy sizes (720k, 1.2M, 1.44M, 2.88M), a 16 bit FAT otherwise. This can be overridden
with the -F option. Some PC-specific boot sector fields aren't written, and a boot message (option -m) is ignored.
Selects the location of the backup boot sector for FAT32. Default depends on number of reserved sectors, but usually is sector 6. The backup
must be within the range of reserved sectors.
-c Check the device for bad blocks before creating the file system.
-C Create the file given as device on the command line, and write the to-be-created file system to it. This can be used to create the new file sys-
tem in a file instead of on a real device, and to avoid using dd in advance to create a file of appropriate size. With this option, the block-
count must be given, because otherwise the intended size of the file system wouldn't be known. The file created is a sparse file, which actually
only contains the meta-data areas (boot sector, FATs, and root directory). The data portions won't be stored on the disk, but the file neverthe-
less will have the correct size. The resulting file can be copied later to a floppy disk or other device, or mounted through a loop device.
Specify the number of file allocation tables in the file system. The default is 2. Currently the Linux MS-DOS file system does not support
more than 2 FATs.
Specifies the type of file allocation tables used (12, 16 or 32 bit). If nothing is specified, mkdosfs will automatically select between 12, 16
and 32 bit, whatever fits better for the file system size.
Note the bold information above from 'man mkfs.vfat' or 'man mkdosfs'.
Formatting the partition nor setting the boot flag will create a bootable drive. It does not copy the system files i.e. command.com, io.sys, msdos.sys. I'm not familiar with the hardware to know how to get DOS to recognise the IDE drive as C:. If that worked you could possibly use grub4dos to boot linux from the autoexec.bat file on the A drive.
Have you tried to see if it is recognised as B: vs C:?
Personally, I would use MS tools to create the MS partition(s) using fdisk, here you would set the primary as active after creating the partition. You can then format with the format command as 'format c: /s' this would prepare the partition for booting and placing the needed system files.
You could use the Microsoft OS System DVD to create the necessary partitions and this would provide the system boot files.
The solution is:
When I use fdisk to partition the disk, I need to use the option 't' to alter the partition type (i.e. FAT size) after I create a new partition. When I use the option 'p' to print the partition table, the System column will be changed from 'Linux' to 'FATxx' when the partition type is altered.
After that, I can use mkdosfs -F xx /dev/hda to format the partition.