Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: how to get & create partition size precisely?

  1. #11
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: how to get & create partition size precisely?

    Anon0, how about first posting:
    Code:
    sudo fdisk -lu
    And please identify the source partition and the destination drive.

  2. #12
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: how to get & create partition size precisely?

    Quote Originally Posted by anon0 View Post
    is that a disk-wide operation?
    yes

    Quote Originally Posted by anon0 View Post
    What if the source disk is larger than the target disk?
    never tested... but if target is bigger it doesn't matter...

  3. #13
    Join Date
    Jan 2009
    Beans
    98

    Re: how to get & create partition size precisely?

    Quote Originally Posted by caljohnsmith View Post
    Anon0, how about first posting:
    Code:
    sudo fdisk -lu
    And please identify the source partition and the destination drive.
    Sure let's say source is /dev/sdb1 as follows:
    Code:
    Disk /dev/sdb: 120.0 GB, 120034123776 bytes
    255 heads, 63 sectors/track, 14593 cylinders, total 234441648 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Disk identifier: 0x2fee2fee
       Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1       166015710   234436544    34210417+  fd  Linux raid autodetect
    While target is /dev/sda as follows:
    Code:
    Disk /dev/sda: 80.0 GB, 80026361856 bytes
    255 heads, 63 sectors/track, 9729 cylinders, total 156301488 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Disk identifier: 0xe545ed40

  4. #14
    Join Date
    Mar 2008
    Location
    California, USA
    Beans
    8,111

    Re: how to get & create partition size precisely?

    Do you want the destination partition to start at the beginning of the sda drive? I ask because the source partition sdb1 actually starts about 85 GB into the sdb drive. If you would like the destination partition to start at the beginning of the sda drive, how about doing:
    Code:
    echo '63,68420835,fd,*' | sudo sfdisk --no-reread -fuS /dev/sda -N1
    That should create an unformatted partition on your sda drive exactly the same size as the sdb1 partition (about 34 GB). Then reboot, and post the new output of:
    Code:
    sudo fdisk -lu
    And if that shows your new sda1 partition OK, you can copy the sdb1 partition to sda1 with:
    Code:
    sudo apt-get install dcfldd
    sudo dcfldd if=/dev/sdb1 of=/dev/sda1 statusinterval=10 bs=10M conv=notrunc
    Let me know how that goes or if you run into problems.

  5. #15
    Join Date
    Jan 2009
    Beans
    98

    Re: how to get & create partition size precisely?

    thanks caljohnsmith. I actually tried parted again and got it to create the partition in the middle, just to test things out (it's interactive so it's less cryptic). This time it worked because last time I forgot a simple arithmetic: the end sector should be starting position + size of the source partition - 512 bytes, since the starting sector is a part of the partition. Also I noticed that 1GB=10^9 not 1024^3 here.

  6. #16
    Join Date
    May 2008
    Location
    Southern California
    Beans
    231
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: how to get & create partition size precisely?

    If you make a boot disk with g4l, it will give you all the infos you need on that partition.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •