Shrinking 4 parititions on a new HP laptop

Julian H. Stacey jhs at berklix.com
Tue Oct 25 00:55:58 UTC 2011


Hi hackers@
A new purchased HP laptop (pavilion entertainment PC dm3 
	http://reviews.shopping.hp.com/8843/dm3t_series/hp-pavilion-dm3t-customizable-notebook-pc-reviews/reviews.htm
had all 4 partitions occupied with Windows 7 Home Prem OA.
(Maybe the shop did that)

I want just 1 of the 4 fdisk partitions with an MS slice (for h/w
test mainly), & the other 3 with FreeBSD slices (2 boots of different
release & a large common UFS as usual. I've done that often before,
not asking for help on that, but normally the PC just uses a single
fdisk partition so it just a case of shrinking it & allocating the
other 3.

This is a bit trickier, I need to figure what all the other partitons
are for, & how to merge/ remove them down to one.

So first I shrank the main NTFS from 223 G to 65G (for now) &
rebooted MS & it still boots MS,

Next I need to copy data from spare Fdisk F1, F3, F4 partitions to main F2,
leaving the others free for FreeBSD (& also I'll need to tell
Fdisk precisely how big my new shrunken F2 NTFS is).

Maybe one of you has insight what the partitions might be for at present ?

It has a 200M F1 active, then F2 is the main MS FS of most of disk.
	I wonder why they do that ?
		For recovery or repair ?
		Or to later allow an encrypted F2 OS booting from another 
		smaller F1 OS first ?
	I wonder if I can safely merge F1 & F2 ?
Then on F3, HP used 12.6 of 15G for their own software as hardware 
	manufacturer. (Stuff I'll want to move to F2, cos I need
	partitions for BSD) Not sure how I'll move that tree (tar
	I guess as I dont know modern MS or trust any MS) (maybe
	insert a join command if MS still have that (opposite of
	mount, effectively)  to keep the HP seperate yet have paths
	under MS working.

Then F4 is taken too,
	Backup stuff maybe, or suspend ?

My notes chronologically as I worked:
  --------------
  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
  
  Boot a 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
  
  The numbers above add up OK
  	dc: 2048 407552 + p 409600 457328640 + p 457738240 30445568 + p
  	 	488183808 211312 + p 488395120
  
  dmesg announced number of sector for USB da0 but not for ad4.
  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
  
  umount /dev/ad4s2
  /dist/usr/local/sbin/ntfsresize -n -s 65G -v /dev/ad4s2
  	/libexec/ld-elf.so.1: Shared object "libublio.so.1" not found
  
  Discovered make.conf CFLAGS += -static insufficient for sysutils/ntfsprog
  On cross compile host:
  	file /usr/local/sbin/ntfsresize
  		/usr/local/sbin/ntfsresize: ELF 64-bit LSB executable,
  		x86-64, version 1 (FreeBSD), dynamically linked
  		(uses shared libs), for FreeBSD 8.2, stripped
       	cd /usr/ports/sysutils/ntfsprogs
      	unsetenv NOCLEANDEPENDS
      	make clean
  	grep -i static /etc/make.conf
  		CFLAGS += -static  
  	make
  	xs make install package
  		===>   ntfsprogs-2.0.0_1 depends on shared library: ublio.1 - found
  	file /usr/local/sbin/ntfsresize
  		/usr/local/sbin/ntfsresize: ELF 64-bit LSB executable,
  		x86-64, version 1 (FreeBSD), dynamically linked
  		(uses shared libs), for FreeBSD 8.2, stripped
  	cd /usr/ports/devel/libublio
  	make package
  	cd /usr/ports/packages/All
  	ls -l libublio-20070103.tbz ntfsprogs-2.0.0_1.tbz
  		Copy across on another ISB stick & install...
  /dist/usr/local/sbin/ntfsresize -s 65G -v /dev/ad4s2
  	adjusted bm_size: 1983648->1984000      # maybe that give
  	a clue for new fdisk size.
  reboot, usb sticks out
  MS chkdsk runs automatically
  -------------------------------------------

Cheers,
Julian
-- 
Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com
 Reply below, not above;  Indent with "> ";  Cumulative like a play script.
 Format: Plain text. Not HTML, multipart/alternative, base64, quoted-printable.
 Software Freedom Day, Muenchen: 22 Okt  http://berklix.org/sfd/


More information about the freebsd-hackers mailing list