Creating a bootable Clonezilla dual partition USB device

Gerwin JansenSr. IT Engineer
CERTIFIED EXPERT
Apple, Debian, EE, Hardware, MBP, Oracle, Raspberry PI, Shell Scripting, SQL, Testing, Tibco, Windows
Published:
Updated:
When you need to create an image of your computer, you usually have to store the image somewhere. Where did you leave that boot cd with your favorite image software and where to store the image? Store on NAS device, external USB device or DVD? You can use one device for both!
This article describes how you can configure a USB device with 2 partitions where the first partition will contain the image software and the 2nd partition will be used for storing the images. That way you only need 1 (USB) device for creating and storing image(s) of your computer(s).

I’ll be using the free Clonezilla imaging software. Setup is done from a (live) Linux environment. The first partition on the USB device can be recognized by Windows (FAT),  the 2nd partition only by Linux and Clonezilla (EXT2/3).

From (live) linux environment, create an empty USB device

When running VMware, you may have to connect your USB device through Virtual Machine, Removable Devices, <your device>, Connect.

Determine your device ID  using the ‘dmesg’ command, its output will look like this:
 
[62249.491845]  sdb:
                      [62249.532482] sd 3:0:0:0: [sdb] No Caching mode page present
                      [62249.532490] sd 3:0:0:0: [sdb] Assuming drive cache: write through
                      [62249.532575] sd 3:0:0:0: [[b]sdb[/b]] Attached SCSI removable disk

Open in new window

Device ID is sdb in this case.

When your USB device contains data your Linux environment may mount the device automatically, in that case, using the ‘mount’ command, find out where it is mounted:
 
/dev/sdb on /media/42D3-B580 type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)

Open in new window

It is mounted on /media/42D3-B580 in this case.

Unmount it using the ‘umount’ command, like this:
 
umount /media/42D3-B580

Open in new window


Checking with ‘mount’ will show you that the USB device is not mounted anymore. As ‘root’ delete any existing partitions using the fdisk /dev/<device>, d command, like this:
 
fdisk /dev/sdb
                      
                      Command (m for help): d
                      Partition number (1-4): 2

Open in new window

Repeat until all partitions are deleted:
 
Command (m for help): d
                      Selected partition 4
                      
                      Command (m for help): p
                      
                      Disk /dev/sdb: 16.0 GB, 16039018496 bytes
                      64 heads, 32 sectors/track, 15296 cylinders, total 31326208 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
                      
                        Device Boot      Start         End      Blocks   Id  System
                      
                      Command (m for help):

Open in new window

Write changes to your USB device using the ‘w’ command, like this:
 
Command (m for help): w
                      The partition table has been altered!
                      
                      Calling ioctl() to re-read partition table.
                      Syncing disks.
                      vmmint01 etc #

Open in new window

-> Your USB device is now empty, no partitions left on the device.

Create 2 partitions on the USB device, 1st FAT32, 2nd EXT2/3 (data)

2 partitions are created on the USB device, one (FAT) for storing the clone/recovery application Clonezilla and the other for storing data (EXT2/3). I choose a size of 700 Mb for the 1st partition as this will suffice for or storing the clone/recovery application. You may choose a smaller size if you like.

As ‘root’ create partitions using the fdisk /dev/<device>, n command, like this:
 
fdisk /dev/sdb
                      
                      Command (m for help): n
                      Command action
                        e   extended
                        p   primary partition (1-4)
                      p
                      Partition number (1-4, default 1): 1
                      First sector (2048-31326207, default 2048):
                      Using default value 2048
                      Last sector, +sectors or +size{K,M,G} (2048-31326207, default 31326207): +700M
                      
                      Command (m for help): a
                      Partition number (1-4): 1
                      
                      Command (m for help): t
                      Selected partition 1
                      Hex code (type L to list codes): c
                      
                      Command (m for help): p
                      
                      Disk /dev/sdb: 16.0 GB, 16039018496 bytes
                      64 heads, 32 sectors/track, 15296 cylinders, total 31326208 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: 0x6f20736b
                      
                        Device Boot      Start         End      Blocks   Id  System
                      /dev/sdb1   *        2048     1435647      716800    c  W95 FAT32 (LBA)

Open in new window

Now create the 2nd partition:
 
Command (m for help): n
                      Command action
                        e   extended
                        p   primary partition (1-4)
                      p
                      Partition number (1-4, default 2): 2
                      First sector (1435648-31326207, default 1435648):
                      Using default value 1435648
                      Last sector, +sectors or +size{K,M,G} (1435648-31326207, default 31326207):
                      Using default value 31326207
                      
                      Command (m for help): t
                      
                      Hex code (type L to list codes): 83
                      
                      Command (m for help): p
                      
                      Disk /dev/sdb: 16.0 GB, 16039018496 bytes
                      64 heads, 32 sectors/track, 15296 cylinders, total 31326208 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
                      
                        Device Boot      Start         End      Blocks   Id  System
                      /dev/sdb1   *        2048     1435647      716800    c  W95 FAT32 (LBA)
                      /dev/sdb2         1435648    31326207    14945280   83  Linux
                      
                      Command (m for help): w
                      
                      The partition table has been altered!
                      
                      Calling ioctl() to re-read partition table.
                      Syncing disks.
                      vmmint01 etc #

Open in new window

-> You now have 2 partitions on your USB device (without file systems).
Create file systems:
 
vmmint01 etc # mkfs.vfat /dev/sdb1
                      mkfs.vfat 3.0.9 (31 Jan 2010)
                      vmmint01 etc #
                      
                      vmmint01 etc # mkfs.ext3 /dev/sdb2
                      mke2fs 1.41.14 (22-Dec-2010)
                      Filesystem label=
                      OS type: Linux
                      Block size=4096 (log=2)
                      Fragment size=4096 (log=2)
                      Stride=0 blocks, Stripe width=0 blocks
                      934720 inodes, 3736320 blocks
                      186816 blocks (5.00%) reserved for the super user
                      First data block=0
                      Maximum filesystem blocks=3829399552
                      115 block groups
                      32768 blocks per group, 32768 fragments per group
                      8128 inodes per group
                      Superblock backups stored on blocks:
                         32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
                      
                      Writing inode tables: done                            
                      Creating journal (32768 blocks): done
                      Writing superblocks and filesystem accounting information:  done
                      
                      This filesystem will be automatically checked every 31 mounts or
                      180 days, whichever comes first.  Use tune2fs -c or -i to override.
                      vmmint01 etc # 

Open in new window



Creating the 2nd partition can take some time, please be patient.

Note: Windows will only recognize 1 partition on a USB device so it will only see the first 700Mb.

-> You now have 2 partitions on your USB device with file systems. Unplug and plug in your USB device and most Linux systems will automount your 2 devices.

Install live recovery tooling like Clonezilla on 1st partition, bootable

This is how you can install Clonezilla onto the 1st partition of your USB device. I use unetbootin, both available for Linux and Windows.

See: http://www.pendrivelinux.com/using-unetbootin-to-create-a-linux-usb-from-linux/
and: http://unetbootin.github.io

Get  Clonezilla live .iso from here: http://clonezilla.org/downloads/download.php?branch=stable

Get/install unetbootin (see here), then start unetbootin and select ‘DiskImage’ where you browse ‘...’ to the Clonezilla .iso image file, at ‘Type’ select ‘USB Drive’ and the important choice is at ‘Drive’ where you select /dev/sdb1 and press ‘OK’.

Note: unetbootin will only ‘see’ the /dev/sdb1 and /dev/sdb2 devices when they are mounted.

unetbootin may give an ‘overwrite’ warning -> acknowledge that. When finished, press ‘OK’, or ‘Reboot’ if you want to reboot now. You have to set the BIOS of your computer to boot from USB.

When unetbootin has finished, you are ready to make your first image/backup, just reboot with your USB device.

-> You now have a bootable USB device with Clonezilla live on the first partition and available data storage on the 2nd partition.

Clonezilla manual: http://clonezilla.org/clonezilla-live-doc.php
 

Thanks for reading this article. If you find it useful, you can click 'Good Article' below. If not, any feedback is welcome so I can update/improve this article. You can always send me a message. Thanks!
3
11,310 Views
Gerwin JansenSr. IT Engineer
CERTIFIED EXPERT
Apple, Debian, EE, Hardware, MBP, Oracle, Raspberry PI, Shell Scripting, SQL, Testing, Tibco, Windows

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.