Partitioning and formatting a disk drive with Clonezilla

I needed to back up an HP Pavilion laptop running Windows XP, so I attached a Thermaltake Black Widow BlacX Duet Dual Hard Drives Docking Station to the laptop and inserted a new unpartitioned 2.5" hard disk drive in the docking station to use as a backup drive for the internal drive in the laptop. I intended to use Clonezilla to backup the internal drive to the external USB-attached drive, but I didn't want to clone one drive to the other, since I wanted to be able to store multiple backups on the external drive, so I needed to partition and format the external drive.

If you need to create and format a partition on an external drive, e.g., a USB-attached drive that you will be using to backup a system with Clonezilla using image files on the destination drive, rather than cloning the source drive to the destination drive (for cloning one drive to another, see Cloning a Drive with Clonezilla), the following steps can be taken after booting from a Clonzezilla Live CD/DVD.

  1. At the Start Clonezilla screen where you have the following choices, choose "Enter_shell" and then hit Enter or use the Tab key to tab to OK and hit Enter:
    Start_ClonezillaStart Clonezilla
    Enter_shellEnter command line prompt
  2. The next screen will be a Choose mode screen where you can select from the following, choose "cmd":
    poweroffPoweroff
    rebootReboot
    cmdEnter command line prompt
    rerun1Start over (image repository /home/partimag, if mounted, will be unmounted)
  3. You will then see a prompt like the following where you can type sudo fdisk /dev/sda, presuming the disk drive to be partitioned is sda. If there is only one drive in the system, it will normally be sda or, possibly, hda, if it is an older PATA drive.
    user@debian:~$

    If you wish to first check the partitioning on the internal drive that you will backup using Clonzilla you can examine it with fdisk first with a command such as the one below:

    user@debian:~$sudo fdisk -l /dev/sda
    
    Disk /dev/sda: 80.1 GiB, 86052847104 bytes, 168071967 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
    Disklable type: dos
    Disk identifier: 0x69205244
    
    Device      Boot      Start        End    Sectors   Size Id Type
    /dev/sda1p1       218129509 1920119918 1701990410 811.6G 72 unknown
    /dev/sda1p2       729050177 1273024900  543974724 259.4G 74 unknown
    /dev/sda1p3       168653938  168653938          0     0B 65 Novell Netware 386
    /dev/sda1p4      2692939776 2692991410      51635  25.2M  0 Empty
    
    Partition table entries are not in disk order.
    user@debian:~$

    The drive and partition details shown will depend on the drive and how it has been configured. In the example above there are 4 partitions on the drive p1 through p4. The -l option to the fdisk command lists the partitions. If you want to see the partitions on all drives you can use fdisk -l without any other arguments on the command line.

    You can verify that there are no existing partitions on the new drive with sudo fdisk /dev/sdb.

    Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 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
    user@debian:~$

    Since no partitions are listed, I know that sdb is the external unpartitioned drive I need to configure. Drives are usually designated sda, sdb, sdc, etc.

    If you now wish to create partitions on the new drive, you can type sudo fdisk /dev/sdb, presuming the new drive is sdb You will then see a "Command (m for help):" prompt.

    Welcome to fdisk (util-linux 2.26.2).
    Changes will remain in memory only, until you decide to write them. Be
    careful before using the write command.
    
    
    Command (m for help):

    You can type m to see a list of available commands. To see the partition arrangement on the drive type p and hit Enter. You can type o to create a new empty DOS partition table.

    Command (m for help): 0
    
    Created a new DOS disklabel with disk identifier 0xb2cd55b0

    The partition table types available are as follows:

    gcreate a new empty GPT partition table
    Gcreate a new empty SGI (IRIX) partition table
    ocreate a new empty DOS partition table
    screate a new empty Sun partition table

    To add a new partition that will occupy the entire disk drive, you can type n to add a new partition to the drive.

    Command (m for help): n
    Partition type
       p   primary (0 primary, 0 extended, 4 free)
       e   extended (container for logical partitions)
    Select (default p):
    
    Using default response p.
    Partition number (1-4, default 1):
    First sector (2048-976773167, default 2048):
    Last sector, + sectors or +size{K,M,G,TP} (2048-976773167, default 976773167):
    Created a new partition 1 of type 'Linux' and of size 465.8 GiB.
    
    Command (m for help):

    There can be up to 4 primary partitions on the drive; if you hit Enter a primary partition will be created by default. You can continue to hit Enter at the prompts to take the default values and allocate the entire disk to 1 partition as shown above. You can type p to see the details for the newly created partition. as shown below.

    Command (m for help): p
    Disk /dev/sdb: 465.8 GiB 500107862016 bytes, 976773168 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
    Disklabel type: dos
    Disk identifier: 0xb2cd55b0
    
    Device      Boot      Start       End   Sectors   Size Id Type
    /dev/sdb1              2048 976773167  97677120 465.8G 83 Linux
    
    Command (m for help):

    The new partition won't actually be created until you type w to write the partition table to disk and exit from fdisk. If you type q to quit without saving changes, the partitioning you have done will be lost.

    To format the partition you have created, you can use the command sudo mkfs.ext3 /dev/sdb1 to format it with the ext3 file system.

    user@debian:~$ sudo mkfs.ext3 /dev/sdb1
    mke2fs 1.42.13 (17-May-2015)
    Creating filesystem with 122096390 4k blocks and 30531584 inodes
    Filesystem UUID: ab1b83f1-9e9d-49f0-8032-4bcb7e95590e
    Superblock backups stoed on blocks:
            32768, 98304, 163840, 229376, 293912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
            102400000
    
    Allocating group tables: done
    Writign inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done
    
    user@debian:~$

    If you wish to format the drive using another filesystem rather than ext3, you can use the following syntax for the mkfs command where fstype is the file system type you wish to use for formatting the drive:

    mkfs -t fstype /dev/DEVICE

    Or you can use the syntax mkfs.fstype

    Options for file system type include the following:

    bfs
    cramfs
    exfat
    ext2
    ext3
    ext4
    fat
    hfs
    minix
    msdos
    ntfs
    ufs
    vfat

    You can see the supported filesystems by issuing the command ls /sbin/mkfs*.

    After the format process is completed, you can start Clonezilla from the shell prompt by typing sudo clonezilla or you can reboot from the Live CD or DVD. You can then create a backup of the internal drive to the external drive by storing backup files on the external drive rather than cloning the internal drive to the external drive. Clonezilla supports two modes:

    (1) clone/restore a disk or partition using an image
    (2) disk to disk or partition to partition clone/restore.

    You don't need the destination disk to already be partitioned and formatted if you are cloning the source disk to the destination disk, but if you wish to "clone" the disk to an image file, instead, you will need to have a usable partition on the destination drive. E.g., in the case of an HP Pavilion laptop with Windows XP on it, I see a 465.8 GB partition on the external drive being available for backing up the internal drive after I partitioned the external drive. I.e., I can mount it as /home/partimag for the Clonezilla image(s) repository.

    Now we need to mount a device as /home/partimag (Clonezilla image(s) repository so that we can read or save the image in /home/partimag.
    ///NOTE/// You should NOT mount the partition you want to backup as /home/partimag
    The partition name is the device name in GNU/Linux. The first partition in the first disk is "hda1" or "sda1", the 2nd partition in the first disk is "hda2" or "sda2", the first partition in the second disk is "hdb1" or "sdb1"... If the system you want to save is MS windows, normally C is hda1 (for PATA) or sda1 (for PATA, SATA or SCSI), and D: could be hda2 (or sda2), hda5 (or sda5)...

    sda1 80.1G_ntfs(In_FUJITSU_MHV2100A)_FUJITSU_MHV2100AT_PL_NS91T6228C30
    sda2 12G_vfat_HP_RECOVERY(In_FUJITSU_MHV2100A)_FUJITSU_MHV2100AT_PL_NS91T6228C30
    sda3 1G_ntfs(In_FUJITSU_MHV2100A)_FUJITSU_MHV2100AT_PL_NS91T6228C30
    sdb1 465.8G(In__-WX61A44L4423)_WDC_WD50_-WX61A44L4423_67304734999999999999-0:0

    <Ok>                                    <Cancel>

References:

  1. HowTo: Formatting Linux Filesystem
    By: Vivek Gite
    Date: January 30, 2006
    nixCraft
  2. Linux Hard Disk Format Command
    By: Vivek Gite
    Date: March 10, 2008
    nixCraft

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Friday July 3, 2015