Shrinking 4 parititions on a new HP laptop (fwd)

Garrett Cooper yanegomi at gmail.com
Tue Oct 25 19:50:30 UTC 2011


On Tue, Oct 25, 2011 at 11:26 AM, Julian H. Stacey <jhs at berklix.com> wrote:
> Hi sysinstall at freebsd.org,
> I posted similar to below to hackers Tue, 25 Oct 2011 02:26:05 +0200, but
> no reply, so reformulating & adding info & hoping sysinstall@ may
> have ideas what non BSD partitions one might encounter on a newly
> purchased PC, & how best to remove before installing FreeBSD ?
>
> I'm not asking for help on BSD commands, just want ideas what the
> mess of 4 MS partitions might be, how best to move them aside.
>
> A new purchased HP laptop (pavilion entertainment PC dm3
> has all 4 partitions occupied with MS (done by HP or shop)
> (Label under laptop: Windows 7 Home Prem OA.)
>
> I want to reduce MS to just 1 of the 4 fdisk partitions
> & the other 3 for FreeBSD slices (2 boots of different
> release of BSD & a large common UFS as I usual do).
>
> Normaly easy, previously I've found eg with XP, that new MS machines use
> just a single Fdisk partition eg F1.  This PC is trickier, All 4 are used !
>
>  MS `My Computer' says
>        Local Disk (C:)         176    Gig Free of 218   GB
>        RECOVERY (D:)             2.39 GB Free of   14.5 GB
>        HP_TOOLS (E:)            92.5  MB Free of   99.1 MB
>
>  Booting BSD-8.2 USB image: fdisk /dev/ad4
>        Partition 1     Sysid 7,NTFS etc                   199 M Active
>                        start      2048 size    407552
>        Partition 2     Sysid 7,NTFS etc                223305 M
>                        start    409600 size 457328640
>        Partition 3     Sysid=7,NTFS etc                 14866 M
>                        start 457738240 size  30445568
>        Partition 4     Sysid 12,DOS/Win-95 32 bit FAT     103 M
>                        start 488183808 size    211312
>
> F1 :    200 Meg
>        As F2 is the main MS FS occupying most of disk.
>        I tried fdisk setting active=2,
>        MS failed to boot then. Reverted back to Active=1 & MS booted again.
>
>        I wonder what theyre using F1 for ?
>                Repair base ?
>                Or later to allow an encrypted F2 OS booting from another
>                smaller F1 OS first ?
>                Or just to make it harder for people install BSD
>                Linux or any non MS to find a free partition ?
>
>        Can I merge F1 & F2 somehow ?
>
> F2 = C: Main MS 223 Gig
>        I shrank the F2 main NTFS from 223 G to 65G &
>        check rebooted MS & it still boots MS,
>                From /usr/ports/sysutils/ntfsprogs using
>                /dist/usr/local/sbin/ntfsresize -s 65G -v /dev/ad4s2
>                        adjusted bm_size: 1983648->1984000
>
>        I'm not clear exactly what reduced number of sectors I should
>        tell fdisk for F2.
>                ntfsinfo -m /dev/ad4s2 | /dist/usr/bin/more
>                        sector size: 512
>                        cluster size 4096, volume size in clusters 15869139
>                dc 15869139 4096 * p 64999993344
>        Maybe I should allow 1K more than df shows when mounted,
>        as per others below ?
>
> F3 = D: Recovery 15 G
>        Hmm, this machibe was bought with legal MS inc licence, but
>        no MS DVD - Sigh
>
>        I could boot BSD from USB stick & tar this or F2 to another
>        USB drive.  (if tar loses nothing on ntfs ?)
>
> F4 = E 100 Meg partition
>        7 Meg of HP manufacturer tools. I could copy with tar to a
>        subdir in C: Not sure how I'll save paths for MS to execute,
>        maybe an MS join command to subdir, if MS still have 'join'
>        command (opposite of mount, effectively)
>
> Curiously,
>  dmesg announced number of sector for USB da0 but not for ad4, just:
>  dmesg | grep ad4 # 238475 MB WDC WD2500BEKT UDMA100 SATA 3Gb/s
>
>  cd /dist/sbin
>  kldload /dist/boot/kernel/ntfs.ko
>  mount_ntfs    /dev/ad4s1 /lap/1 ; du -s -k /lap/1     #     25 M
>  mount_ntfs    /dev/ad4s2 /lap/2 ; du -s -k /lap/2     # 48.098 M
>  mount_ntfs    /dev/ad4s3 /lap/3 ; du -s -k /lap/3     # 12,641 M
>  mount_msdosfs /dev/ad4s4 /lap/4 ; du -s -k /lap/4     #    6.7 M of 101 M
>
>  df
>        1Kblocks        Used            Avail   Capacity
>  s1       203775          28815        174960  14%
>  s2    228664319       43896379     184767940  19%     #
>  s3     15222783       12708523       2514260  83%     # ./hp/
>  s4       101562           6762         94800   7%     # ./$RECYCLE.BIN
>                                                        # ./Hewlett-Packard
>
>  Analysis with dc shows F1,F2,F3 fdisk partition entries each 2x512
>  bytes more than df shows as size, but with F4, The DOS FS within
>  the fdisk partiton is considerably smaller:
>
>           203775 2 * p    407550       # fdisk shows    407552
>        228664319 2 * p 457328638       # fdisk shows 457328640
>         15222783 2 * p  30445566       # fdisk shows  30445568
>           101562 2 * p    203124       # fdisk shows    211312
>
>  /dist/usr/local/sbin/ntfsresize -n -s 65G -v /dev/ad4s2

I really don't know if there's a good way to do this other than go
into gparted and hack the partitions (create an extended partition,
force the non-Windows partition to be primary and set the rest to
secondary, etc), but that will probably break HP's recovery software
as it expects a fixed disk layout.

My suggestion is to just create a recovery DVD from within Windows,
blow away the recovery partition(s), and create your BSD stuff. Just
beware that maybe restoring from the HP recovery partitions will blast
away everything on your disk.

One thing that I miss about the old Windows recovery CD stuff that
they used to ship with Dells -- it made life so much easier (instead
now all home PC vendors cram it onto HDDs, just because it's easier
and now mom and pop won't lose their CDs by accident).

HTH,
-Garrett


More information about the freebsd-sysinstall mailing list