PrintLogo

Debian on a USBCard -- Part 1 - Creating the filesystem




We have used our GIAGD distribution for our various utility computers that run stuff like our 8048 dev system and our chicken cam. It is a bit of a pain to maintain our own distribution based on uClibc; however, there is a fabulous new development. You can now get a port of Debian woody compiled with uClibc from the uClibc site. We have a small USBCard we bought from here, and thought that it would be most fabulous to have an entire GNU/Linux system on one of these. It would be easy to plug this in to a server and boot with a floppy with the right kernel for recovery. First, let's plug it in and create a filesystem:

root@srv-1 / # fdisk /dev/sdc
Command (m for help): p
Disk /dev/sdc: 260 MB, 260046848 bytes
8 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 496 * 512 = 253952 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   ?     3769701     4109801    84344761   69  Unknown
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(68, 13, 10) logical=(3769700, 2, 42)
Partition 1 has different physical/logical endings:
phys=(288, 115, 43) logical=(4109800, 1, 25)
Partition 1 does not end on cylinder boundary.
/dev/sdc2   ?     3430483     7200406   934940732+  73  Unknown
Partition 2 has different physical/logical beginnings (non-Linux?):
phys=(371, 114, 37) logical=(3430482, 6, 38)
Partition 2 has different physical/logical endings:
phys=(366, 32, 33) logical=(7200405, 1, 4)
Partition 2 does not end on cylinder boundary.
/dev/sdc3   ?           6           6           0   74  Unknown
Partition 3 has different physical/logical beginnings (non-Linux?):
phys=(371, 114, 37) logical=(5, 1, 32)
Partition 3 has different physical/logical endings:
phys=(372, 97, 50) logical=(5, 1, 31)
Partition 3 does not end on cylinder boundary.
/dev/sdc4         5817906     5818012       26207+   0  Empty
Partition 4 has different physical/logical beginnings (non-Linux?):
phys=(0, 0, 0) logical=(5817905, 4, 25)
Partition 4 has different physical/logical endings:
phys=(0, 0, 0) logical=(5818011, 1, 49)
Partition 4 does not end on cylinder boundary.
Partition table entries are not in disk order

Yow!! The partition table looks odd. That's OK, we're deleting the partitions anyway.

Command (m for help): d
Partition number (1-4): 1
Command (m for help): d
Command (m for help): d
Partition number (1-4): 3
Command (m for help): d
Selected partition 4
Command (m for help): p
Disk /dev/sdc: 260 MB, 260046848 bytes
8 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 496 * 512 = 253952 bytes
Device Boot      Start         End      Blocks   Id  System

Let's create a root and swap partition:

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1024, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-1024, default 1024): +230M
Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (908-1024, default 908):
Using default value 908
Last cylinder or +size or +sizeM or +sizeK (908-1024, default 1024):
Using default value 1024
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap)
Command (m for help): p
Disk /dev/sdc: 260 MB, 260046848 bytes
8 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 496 * 512 = 253952 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         907      224905   83  Linux
/dev/sdc2             908        1024       29016   82  Linux swap

Make the root partition active:

Command (m for help): a
Partition number (1-4): 1
Command (m for help): p
Disk /dev/sdc: 260 MB, 260046848 bytes
8 heads, 62 sectors/track, 1024 cylinders
Units = cylinders of 496 * 512 = 253952 bytes
Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         907      224905   83  Linux
/dev/sdc2             908        1024       29016   82  Linux swap

Yes, Agatha did remember for the first time that type 82 was swap. :) Write the partition table:

Command (m for help):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
root@srv-1 / #

Create an ext3 filesystem:

root@srv-1 / # mkfs.ext3 /dev/sdc1
mke2fs 1.34 (25-Jul-2003)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
56448 inodes, 224904 blocks
11245 blocks (5.00%) reserved for the super user
First data block=1
28 block groups
8192 blocks per group, 8192 fragments per group
2016 inodes per group
Superblock backups stored on blocks:
8193, 24577, 40961, 57345, 73729, 204801, 221185
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
root@srv-1 / #

In the next part of this article we will transfer the filesystem to the USBcard.



This article comes from NetAdminTools:
http://www.netadmintools.com/

The URL for this story is:
http://www.netadmintools.com/art356.html

Copyright 1997-2007 NetAdminTools.com. Read our Terms of Use.