--- trunk/www/working/usb.html 2011/06/06 18:57:10 180 +++ trunk/www/working/usb.html 2011/06/22 16:47:21 181 @@ -126,99 +126,6 @@

And that's it. Your usb device is ready to boot!!!

-

Using the extra space [^]

- -

-If your usb device is more than 400MB in size, the above command will leave the remaining space unused. To verify it, execute the command: -

-

fdisk -l /dev/sdc

- -

You should get something similar to this:

- - -

-Disk /dev/sdc: 1048 MB, 1048576000 bytes
-64 heads, 32 sectors/track, 1000 cylinders, total 2048000 sectors
-Units = sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / 512 bytes
-Disk identifier: 0x77a5188f
-
-   Device Boot  Start  End  Blocks  Id  System -/dev/sdc1    *      1  384  393216  17  Hidden HPFS/NTFS -

-

-As you can see, we are currently using 348 out of 1000 cylinders of the disk. The remaining disk space (~600MB) can still be used, executing the following commands (user input is displayed in magenta, comments are in brown): -

- -

-fdisk /dev/sdc
-command (m for help): n (create new partition)
-command action
- e extended
- p primary partition (1-4)
-p
-partition number (1-4): 4 (create partition sdc4)
-first cylinder (385-1000, default 385):
-using default value 385
-last cylinder, +cylinders or +size{k,m,g} (385-1000, default 1000):
-using default value 1000
-
-command (m for help): p (display partition table)
-
-disk /dev/sdc: 1048 mb, 1048576000 bytes
-64 heads, 32 sectors/track, 1000 cylinders
-units = cylinders of 2048 * 512 = 1048576 bytes
-sector size (logical/physical): 512 bytes / 512 bytes
-i/o size (minimum/optimal): 512 bytes / 512 bytes
-disk identifier: 0x77a5188f
-
-   device boot  start   end  blocks   id  system
-/dev/sdc1   *       1   384  393216   17  hidden hpfs/ntfs
-/dev/sdc4         385  1000  630784   83  linux
-
-
-command (m for help): t (change partition type)
-partition number (1-4): 4
-hex code (type l to list codes): b
-changed system type of partition 4 to b (w95 fat32)
-
-command (m for help): p (display partition table)
-
-disk /dev/sdc: 1048 mb, 1048576000 bytes
-64 heads, 32 sectors/track, 1000 cylinders
-units = cylinders of 2048 * 512 = 1048576 bytes
-sector size (logical/physical): 512 bytes / 512 bytes
-i/o size (minimum/optimal): 512 bytes / 512 bytes
-disk identifier: 0x77a5188f
-
-   device boot  start   end  blocks   id  system
-/dev/sdc1   *       1   384  393216   17  hidden hpfs/ntfs
-/dev/sdc4         385  1000  630784    b  w95 fat32
-
-command (m for help): w (write partition table to disk and exit)
-The partition table has been altered!
-
-Calling ioctl() to re-read partition table.
-
-WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
-The kernel still uses the old table. The new table will be used at
-the next reboot or after you run partprobe(8) or kpartx(8)
-Syncing disks. -

- -

-At this point you should disconnect and reconnect your usb device. When it's recognised, you can format the partition you've just created -

- -

-mkdosfs -F 32 /dev/sdc4 -

- -

-The partition is now ready for use!!! -

-

Installing the "hard" way [^]

If the "easy" way does not work there is an alternative; you will use the Clonezilla-SysRescCD ISO file (or CD) to copy and modify a couple of files on the USB disk, and finally make it bootable, using syslinux and its configuration file syslinux.cfg.

@@ -253,10 +160,26 @@ cp -r /mnt/mycd/* /mnt/usbdevice
umount /mnt/mycd; rmdir /mnt/mycd
cd /mnt/usbdevice
-rm isolinux/*.cfg
-mv isolinux/* .
-rmdir isolinux
-cd; umount /dev/sdc4
+cp syslinux/*.cfg isolinux
+cp syslinux/*.png isolinux
+rm -rf syslinux
+mv isolinux syslinux

+ +
+Since you are using any linux box to complete this procedure,
you have to use the syslinux installation provided by this linux box.

Otherwise, you will probably end up with an unbootable device...
+ +

First thing you have to do is find where syslinux is installed. The best way to do that is look for a file named vesamenu.c32. You can use locate, find, or any other distribution specific tool for that. In Debian (and its derivatives like Ubuntu, LMDE etc.) this file is under /usr/lib/syslinux, so I'll just use that for the following code.

+ +

cd syslinux
+for f in *.c32
+do
+cp -v /usr/lib/syslinux/$f .
+cd ..
+done

+ +

In either case, unmount the device and delete the mount point (directory).

+ +

cd; umount /dev/sdc4
rmdir /mnt/usbdevice

Finally make your USB device bootable, by executing

@@ -273,12 +196,13 @@ mount /dev/sr0 /mnt/mycd
mkdir /mnt/usbdevice
mount /dev/sdc4 /mnt/usbdevice
-cp -r /mnt/mycd/* /mnt/usbdevice
+cp -rv /mnt/mycd/* /mnt/usbdevice
umount /mnt/mycd
cd /mnt/usbdevice
-rm isolinux/*.cfg
-mv isolinux/* .
-rmdir isolinux
+cp syslinux/*.cfg isolinux
+cp syslinux/*.png isolinux
+rm -rf syslinux
+mv isolinux syslinux
cd; umount /dev/sdc4

Finally make your USB device bootable, by executing

@@ -297,9 +221,10 @@

Now all you have to do is make your USB disk bootable. In order to do that you have to open a DOS window (in Windows XP press "Start / Run " and type cmd). Then type at DOS prompt:

K:
@@ -336,15 +261,18 @@

-Disk /dev/sdc: 1031 MB, 1031798272 bytes
-64 heads, 32 sectors/track, 983 cylinders
-Units = cylinders of 2048 * 512 = 1048576 bytes
+Disk /dev/sdc: 4043 MB, 4043309056 bytes
+125 heads, 62 sectors/track, 1018 cylinders, total 7897088 sectors
+Units = sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disk identifier: 0x596bbd85

-   Device  Boot  Start  End   Blocks  Id  System
-/dev/sdc4     *      1  983  1006576   6  FAT16
+   Device Boot      Start         End      Blocks   Id  System
+/dev/sdc1   *          63     1461914      730926    b  W95 FAT32

-


If the partition is not active (no astrisk), execute:

+


If the partition is not active (no asterisk), execute:

fdisk /dev/sdc

and issue "Command: " a (toggle a bootable flag) and "Partition number:" 4 (for /dev/sdc4).

@@ -404,12 +332,12 @@ The procedure to do that is the following:

-Boot SystemRescueCD (or if that's not possible yet, bot Clonezilla Linux and get to the command line) using the option To RAM, and when it is fully loaded, execute the following commands:

+Boot SystemRescueCD (or if that's not possible yet, boot Clonezilla Live and get to the command line) using the option To RAM, and when it is fully loaded, execute the following commands:

mkdir /mnt/usbdevice
mount /dev/[device] /mnt/usbdevice
cd /mnt/usbdevice
cp sysresc.cfg sysresc.bak
-sed 's|scandelay=5|scandelay=x [additional params]|'
+sed 's|scandelay=5|scandelay=x [additional params]|' \
sysresc.cfg > sys.cfg
mv sys.cfg sysresc.cfg
cd; umount /dev/[device]
@@ -422,29 +350,121 @@ If, for example, you want to increase the device scan delay to maximum, the above commands would become:

mkdir /mnt/usbdevice
-mount /dev/sdc4 /mnt/usbdevice
+mount /dev/sdc1 /mnt/usbdevice
cd /mnt/usbdevice
cp sysresc.cfg sysresc.bak
sed 's|scandelay=5|scandelay=10|' sysresc.cfg > sys.cfg
mv sys.cfg sysresc.cfg
-cd; umount /dev/sdc4
-syslinux /dev/sdc4
+cd; umount /dev/sdc1
+syslinux /dev/sdc1
reboot

If, in addition to that, you had to use the boot parameter usbstick, then it would be:

mkdir /mnt/usbdevice
-mount /dev/sdc4 /mnt/usbdevice
+mount /dev/sdc1 /mnt/usbdevice
cd /mnt/usbdevice
cp sysresc.cfg sysresc.bak
sed 's|scandelay=5|scandelay=10 usbstick|' sysresc.cfg > sys.cfg
mv sys.cfg sysresc.cfg
-cd; umount /dev/sdc4
-syslinux /dev/sdc4
+cd; umount /dev/sdc1
+syslinux /dev/sdc1
reboot

In case something goes wrong with your new settings, you can always rename sysresc.bak to sysresc.cfg, either from linux or Windows.

+

Using the extra space [^]

+ +

+If your usb device is more than 450MB in size, the above procedure will leave the remaining space unused. To verify it, execute the command: +

+

fdisk -l /dev/sdc

+ +

You should get something similar to this:

+ + +

+Disk /dev/sdc: 4043 MB, 4043309056 bytes
+125 heads, 62 sectors/track, 1018 cylinders, total 7897088 sectors
+Units = sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disk identifier: 0x596bbd85
+
+   Device Boot      Start         End      Blocks   Id  System
+/dev/sdc1   *          63     1461914      730926    b  W95 FAT32 + +

+

+As you can see, we are currently using 1461914 out of 7897088 sectors of the disk. The remaining disk space (~3GB) can still be used, to save backups, for example, executing the following commands (user input is displayed in magenta, comments are in brown): +

+ +

+# fdisk /dev/sdc
+command (m for help): n (create new partition)
+command action
+ e extended
+ p primary partition (1-4)
+p
+partition number (1-4): 4 (create partition sdc4)
+First sector (1461915-7897087, default 1461915):
+using default value 1461915
+Last sector, +sectors or +size{K,M,G} (1461915-7897087, default 7897087):
+using default value 7897087
+
+command (m for help): p (display partition table)
+
+Disk /dev/sdd: 4043 MB, 4043309056 bytes
+125 heads, 62 sectors/track, 1018 cylinders, total 7897088 sectors
+Units = sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disk identifier: 0x596bbd85
+
+/dev/sdc1   *          63     1461914      730926    b  W95 FAT32 +/dev/sdc4         1461915     7897087     3217586+  83  Linux +
+
+command (m for help): t (change partition type)
+partition number (1-4): 4
+hex code (type l to list codes): b
+changed system type of partition 4 to b (W95 FAT32)
+
+command (m for help): p (display partition table)
+
+Disk /dev/sdd: 4043 MB, 4043309056 bytes
+125 heads, 62 sectors/track, 1018 cylinders, total 7897088 sectors
+Units = sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / 512 bytes
+Disk identifier: 0x596bbd85
+
+   device boot  start   end  blocks   id  system
+/dev/sdc1   *          63     1461914      730926    b  W95 FAT32 +/dev/sdc4         1461915     7897087     3217586+   b  W95 FAT32
+
+command (m for help): w (write partition table to disk and exit)
+The partition table has been altered!
+
+Calling ioctl() to re-read partition table.
+
+WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
+The kernel still uses the old table. The new table will be used at
+the next reboot or after you run partprobe(8) or kpartx(8)
+Syncing disks. +

+ +

+At this point you should disconnect and reconnect your usb device. When it's recognised, you can format the partition you've just created +

+ +

+mkdosfs -F 32 /dev/sdc4 +

+ +

+The partition is now ready for use!!! +