Rearranging & enlarging my partiiton space on the drive

I want to rearrange the space in various partitions on the hard drive., making home and root larger.

I have auxiliary drives where I can store information while I do the rearranging. I understand about partition images but wonder if I really need to use them. I’d rather just copy files around if that’s permissible.

I will use a Suse live CD to do the rearranging.

Will it work if I copy the file system tree of the root partition to an external ext3 partition, including hidden files, maintaining the links and whatever as a way to store the root partition. Then reformat my root partition and enlarge it. Then copy the root file system tree back on.

The partition order won’t change so Grub and fstab will be OK.

I would use this archival form of cp to move files around:

cp -a /origin_directory/.  /storage_place

The period after the slash (/.) will copy hidden files and I think that the -a option will preserve ownerships, time stamps and links.

I know it works for /home. I wonder if it works for root partition?

Have I missed anything?

Thanks
Swerdna

If there are subdirectories, you missed out the “-r” here.

I did this “operation” twice a few months ago with two /-partitions and it worked flawlessly.


cp -ar /foo /bar

Just don’t delete the old entry in /boot before you know the new / works.

You could also use good old mc for that.

@Akoellh
“cp -ar” is not needed because by specifying “-a”, “-r” is implicit.

@swerdna
Actually, “cp -a /origin_directory /storage_place” will do it, including the hidden files.

To my defense, the man pages (plural, I also have german man pages installed) differ here, in the german man page -R and -r are seperated (in the english man page they both refer to “copy directories recursively” only):

(translation below)
-a, --archive
Genau wie -dpR.

(= “same as -dpR”)

-R, --recursive
Rekursives Kopieren von Verzeichnissen.

(“recursive copying of directories”)

   -r     Rekursives kopieren, nicht-Verzeichnisse als Dateien. WARNUNG: verwenden Sie -R wenn unter Umständen Spezialdateien wie FIFOs oder /dev/zero kopiert werden

(“Recursive copying, non-directories are copied as files. WARNING: use -R if you want to copy special files like FIFOs or /dev/zero”)

although the differences are not really relevant here as of course one normally does not copy those special files.

Yes, in English man pages (that is what I use), -r and -R are the same!
Anyway, I will try out both options myself.

Thanks you guys. And I don’t remember why I put the period after the slash. Did a brief test with and without the period and the hidden files copy in both modes. So I must have been dreaming about the need for a period. Does anyone know where I might have got the myth in my head about the need for a period?

Anyway, just for interest, here’s the reason for all this: I booted into openSUSE 11.1 yesterday and the boot halted with an fstab error message. I had openSUSE 11.0 on the drive as well so I could (multiboot) get into 11.0 to investigate what was wrong with openSUSE 11.1 installation. My 11.1 home partition had vanished from the drive. And I hadn’t backed up the last month’s work – what a slack idiot I am – and I always tell ppl on these forums to do backups but forgot myself (pride cometh before the fall).

Anyway, six hours of cursing and beating the children later – I’d located a blank space on the drive, turned it back into an ext3 partition, discovered it was the missing /home, and backed up everything on it to a usb drive.

But the whole thing left my partitions in disarray, even though I have the root and home file trees stored nicely now. So I’m taking the opportunity to enlarge the root and home partitions as well as restoring them.

So hence my questions – and thanks again

Swerdna