Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: ntfs resize for DSL< Next Oldest | Next Newest >
yiji Offline





Group: Members
Posts: 2
Joined: Nov. 2005
Posted: Jan. 02 2007,17:23 QUOTE

Happy New Year!

I was trying to resize my windows xp system (NTFS) to get more free space by using DSL Live CD.

I found gparted extension for DSL. But it says gparted need ntfsprogs package installed in order to get ntfsresize working. I could not found ntfsprogs extension in DSL website. Is it hard to make the ntfsprogs extension for DSL? How can I do it?

Thank you for your help!

Yiji
Back to top
Profile PM 
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Jan. 04 2007,19:11 QUOTE

You can download ntfsprogs using "apt-get install" - I did this a couple of weeks ago.

It looks like ntsfprogs should repartition an ntfs drive but I did not try it yet...
Back to top
Profile PM 
Juanito Offline





Group: Members
Posts: 1601
Joined: Sep. 2005
Posted: Jan. 11 2007,18:58 QUOTE

After much Google searching I managed to find out how to use ntfsprogs to shrink the partition on a hd with a single ntfs partition in order to make room for a second partition to be formatted for a DSL hd install.

This was run from a combination floppy, usb stick boot using DSL 3.2RC3

First install ntfsprogs:

# apt-get install ntfsprogs

Get ntfs info on the drive you wish to partition - note that I tried this on four ntfs hd and only one did not have errors (that windows had not reported), luckily it was the one I wanted to partition:

# ntfsresize --info /dev/sdc1
ntfsresize v1.9.4
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 36701164032 bytes (36702 MB)
Current device size: 36701167104 bytes (36702 MB)
Checking filesystem consistency ...
 100.00 percent completed
Accounting clusters ...
Space in use       : 8025 MB (21.9%)
Collecting shrinkage constrains ...
Estimating smallest shrunken size supported ...
File feature         Last used at      By inode
$MFT               :       608 MB             0
Multi-Record       :      7944 MB          3712
You might resize at 8024940544 bytes or 8025 MB (freeing 28677 MB).
Please make a test run using both the -n and -s options before real resizing!

Next make a test run - in this case I emulated shrinking the 36GB single partition to 25GB:

# ntfsresize --no-action --size 25000M /dev/sdc1
ntfsresize v1.9.4
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 36701164032 bytes (36702 MB)
Current device size: 36701167104 bytes (36702 MB)
New volume size    : 24999993856 bytes (25000 MB)
Checking filesystem consistency ...
 100.00 percent completed
Accounting clusters ...
Space in use       : 8025 MB (21.9%)
Collecting shrinkage constrains ...
Needed relocations : 0 (0 MB)
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
The read-only test run ended successfully.

Assuming you made a back-up, take a deep breath and go for the real thing:

# ntfsresize --size 25000M /dev/sdc1
ntfsresize v1.9.4
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 36701164032 bytes (36702 MB)
Current device size: 36701167104 bytes (36702 MB)
New volume size    : 24999993856 bytes (25000 MB)
Checking filesystem consistency ...
 100.00 percent completed
Accounting clusters ...
Space in use       : 8025 MB (21.9%)
Collecting shrinkage constrains ...
Needed relocations : 0 (0 MB)
WARNING: Every sanity check passed and only the DANGEROUS operations left.
Please make sure all your important data had been backed up in case of an
unexpected failure!
Are you sure you want to proceed (y/[n])? y
Schedule chkdsk for NTFS consistency check at Windows boot time ...
Resetting $LogFile ... (this might take a while)
Updating $BadClust file ...
Updating $Bitmap file ...
Updating Boot record ...
Syncing device ...
Successfully resized NTFS on device '/dev/sdc1'.
You can go on to shrink the device e.g. with 'fdisk'.
IMPORTANT: When recreating the partition, make sure you
 1)  create it with the same starting disk cylinder
 2)  create it with the same partition type (usually 7, HPFS/NTFS)
 3)  do not make it smaller than the new NTFS filesystem size
 4)  set the bootable flag for the partition if it existed before
Otherwise you may lose your data or can't boot your computer from the disk!

Read the ntfs info again to check that the expected happened:

# ntfsresize --info --force /dev/sdc1
ntfsresize v1.9.4
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 24999993856 bytes (25000 MB)
Current device size: 36701167104 bytes (36702 MB)
Checking filesystem consistency ...
 100.00 percent completed
Accounting clusters ...
Space in use       : 8025 MB (32.1%)
Collecting shrinkage constrains ...
Estimating smallest shrunken size supported ...
File feature         Last used at      By inode
$MFT               :       608 MB             0
Multi-Record       :      7944 MB          3712
You might resize at 8024584192 bytes or 8025 MB (freeing 16975 MB).
Please make a test run using both the -n and -s options before real resizing!

Make a back-up of the partition table and master boot record:

# sfdisk -d /dev/sdc > /path-to-file/sdc.pt
# dd if=/dev/sdc of=/path-to-file/sdc.mbr bs=512 count=1
1+0 records in
1+0 records out
512 bytes transferred in 0.015464 seconds (33109 bytes/sec)

Take a deeper breath and make a new partition table:

# fdisk /dev/sdc

The number of cylinders for this disk is set to 4462.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): m
Command action
d   delete a partition
m   print this menu
n   add a new partition
p   print the partition table
t   change a partition's system id
w   write table to disk and exit

[list the existing partition - actually the one before resizing]

Command (m for help): p

Disk /dev/sdc: 36.7 GB, 36703934464 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot    Start       End    Blocks   Id  System
/dev/sdc1             1      4462  35840983+   7  HPFS/NTFS

[delete the existing partition table since ntfsprogs changed it]

Command (m for help): d
Selected partition 1

[create a new partition table entry, Google suggested to make it slightly larger than the ntfsprogs resize, hence +25140M instead of +25000M]

Command (m for help): n
Command action
  e   extended
  p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-4462, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-4462, default 4462): +25140M

[set the fs type to ntfs - note it must be ntfs]

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 7
Changed system type of partition 1 to 7 (HPFS/NTFS)

[Check things look OK]

Command (m for help): p

Disk /dev/sdc: 36.7 GB, 36703934464 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot    Start       End    Blocks   Id  System
/dev/sdc1             1      3057  24555321    7  HPFS/NTFS

[Write the new partition table]

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

Check ntfs info one final time

# ntfsresize --info --force /dev/sdc1
ntfsresize v1.9.4
NTFS volume version: 3.1
Cluster size       : 4096 bytes
Current volume size: 24999993856 bytes (25000 MB)
Current device size: 25144648704 bytes (25145 MB)
Checking filesystem consistency ...
 100.00 percent completed
Accounting clusters ...
Space in use       : 8025 MB (32.1%)
Collecting shrinkage constrains ...
Estimating smallest shrunken size supported ...
File feature         Last used at      By inode
$MFT               :       608 MB             0
Multi-Record       :      7944 MB          3712
You might resize at 8024584192 bytes or 8025 MB (freeing 16975 MB).
Please make a test run using both the -n and -s options before real resizing!

Now reboot under Windows - ntfsprogs set the ntfs chkdsk flag so windows checks the disk integrity during the first boot. If everything went OK, in my case it did, the Windows disk management service saw a 23.42GB ntfs partition and a 10.76GB unallocated partition.

Hope this helps.
Back to top
Profile PM 
linyiji Offline





Group: Members
Posts: 5
Joined: Dec. 2005
Posted: Jan. 12 2007,20:38 QUOTE

Hi Juanito,

Thank you for your efforts and findings.
I am going to try it as soon as possible.

Yiji
Back to top
Profile PM 
3 replies since Jan. 02 2007,17:23 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: ntfs resize for DSL

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code