Partition for Linux

I have defragmented my hard drive in preparation for a linux installation almost all of my files are currently on one part of the disk but a few are still on the opposite side and I need some way to move them in order to have a nice blank space for a partition. If anyone knows how I can move them I would appreciate your help.

Are you trying a dual boot with Windows and Linux?

If so It doesnt really matter. When you install Linux you can create new partitions and resize old partitions.

Linux uses a different format for it file manager. So you wont need to worry about defragmenting.

I’m not sure what dual boot is, but I just plan to boot one at a time. If I resize my current windows partition will it automatically move the files over?
I defragmented just to free up some space.

Dual boot means you get a nice menu asking which to boot into.

You will never preserve information by partitioning, It will not move automatically around. It will stay where it is and be wiped unless you manually move it.

If you need to defrag to gain disk space, you don’t have enough for Windows swap files etc.

It sounds like you should do a lot more reading up before even beginning this.

Alex

you need a fancy program like partition magic to let you resize partitions [and yes, if it works it will move the files away from that edge… however, if it doesn’t you will loose everything]

not all linux installers come with partition management tools that will let you resize partitions [particularly ntfs partitions, I don’t belive any such installer will let you resize an ntfs partition]

Rule #1: Always be very careful when changing anything lowlevel on your computer - filesystems, partition tables, etc. Back up anything that is important, double-check every change you make.

This goes double when resizing partitions (as opposed to deleting existing partitions and creating new ones) and doubled again when you’re using linux tools to tinker with NTFS.

The major problem with resizing partitions is that even if there is enough free space to shrink the partition, it may not be all at the end of the partition - the files are often spread out over the partition, with free space in many places amongst them. While many defraggers will compact free space, the Windows XP defragger in my experience does not (or at least it doesn’t completely - there is still a lot of fragmented space in the middle of the disk).

So when resizing a partition where there are files near the end of the partition, those files will have to be moved, or they will be lost to the bit bucket (and most likely unrecoverable). This means not only moving the actual files, but fixing the filesystem so the file table points to the right place on the disk - here lies the trap with Linux/NTFS - while the linux hackers have figured out quite a bit of the NTFS format, it’s not complete, so any changes will always have risk involved (hence why most linux kernels have ntfs compiled in as read-only).

That said, there are tools (search for ntfsresize and qtparted) to resize NTFS partitions. They can be very useful in the 99% of times that they work, but you really don’t want to be in that 1% of times when they fail and you lose everything.

Ubuntu resizes and defragments your space on installation, so does mandriva, suse and fedora I believe.

You can also download Parsix which has a program called gparted (start a console and type: sudo gparted). This application allows you to resize almost any partition type non-destructively and it will degrag the partition first moving data out of the way of the new partition.

As always when screwing around with your data, BACKUP.

What distro are you using?
Most of the big ones (Fedora, Mandrake, exc.), allow you to re-partition the HD during installation.

There are also some free tools available on Fedora’s site, that can resize the partitions, and create new ones.

Just make sure to:

  • Read up on everything before hand
  • Backup all your important data
  • make sure you write down the name of the partition (like ‘hda1’), some boot managers expect you to know the partitions.

No one seems to be answering the original question: how to defragment the drive completely before repartitioning.

The reason Windows can’t move those fragments is because they’re in use. Try booting into safe mode. (press F8 when booting) and then try running the disk defragger again.

…Also, using QTparted on Knoppix is actually a better solution than buying Partition Magic, simply on principle. Repartitioning the drive that the OS is running on is always going to be quite dangerous; using a live CD like Knoppix at least lets you unmount the drive completely.

I believe Partition Magic reboots the computer and resizes the partitions before windows boots. Been so long since I did it though. :-?

Another solution is to put your hard drive in as a secondary hard drive in another computer (or boot off another hard drive on your computer). You can then defrag the drive from windows on the other computer before resizing the partition.

Keith. 8)

A little off-topic, but be careful with dual boot systems with Windows as one of them.

All Windows flavors/versions to date completely ignore any partitions that it didn’t make itself because it can only read FAT32 or NTFS (or both). What’s worse, is that if you reinstall Windows, it’ll totally ignore the boot sector, which is set to boot your nifty LiLo menu, and overwrite it with its own. Of course it won’t tell you anything about it, either. This is what’s left me with about 3 linux partitions or so that I can’t use right now without reformatting my drive. ATM I’m not pressed for disk space, but that may be different for you. Besides, it’s annoying to know that you have unused space that you can’t use…

If you make a recovery bootdisk for Lilo or Grub or whatever bootloader you use you shouldn’t have a problem. You just recover your MBR from the bootdisk. Personally I wouldn’t reinstall windows on a drive that has Linux on though. Make sure you’re happy with the windows installation on the drive first.

Keith. 8)

That’s not an issue. It’s whether or not Windoze manages to f*ck itself up within the first two weeks or not. More often than not, that’s the exactly the case.

There’s some driver around the net that enables WinXP to read Linux EXT3 partitions, I had it on my last computer and had no problems IIRC.

There’s some driver around the net that enables WinXP to read Linux EXT3 partitions, I had it on my last computer and had no problems IIRC.[/quote]

Too bad I use WinMe. Yea, I am aware that it blows, but my excuse for not getting a proper OS is that I’m getting a laptop soon. Thanks for the tip though, I’ll look into it once I get said laptop.