On Thu, 2005-08-18 at 08:07 -0500, Jeff Vian wrote: > On Wed, 2005-08-17 at 10:54 +0100, Paul Howarth wrote: > > Garry Harthill wrote: > > > On 17/08/05, Paul Howarth <paul@xxxxxxxxxxxx> wrote: > > > > > >>Garry Harthill wrote: > > >> > > >>>I want to move all data currently on the / mountpoint to another disk > > >>>and then remove the old data. (i just bought a faster disk) > > >>>Is this a simple matter of putting the new disk in. Mounting it > > >>>somewhere. Copying data to the new drive. Altering fstab to point / to > > >>>/dev/hdc2 (for example) then rebooting? Is there anything else i need > > >>>to consider? > > >> > > >>>/boot is mounted on another partition on the slow first disk and will > > >>>be staying. What changes will be needed to grub.conf. At the moment i > > >>>have "root=LABEL=/". What does this need to be changed to? > > >>>"root=/dev/hdc2=/"? > > >> > > >>If /dev/hdc2 is the new root, you'd want "root=/dev/hdc2"; the "LABEL=" > > >>syntax instructs the kernel to read the filesystem labels to find the > > >>root partition. Alternatively you could create the new root filesystem > > >>with a different label (e.g. "newroot") and then change the grub.conf > > >>entry to have "root-LABEL=newroot". > > > > > > > > > Will i need to copy the present root to the new partition from a > > > rescue disk because of open files, etc? Or can it be done at full > > > runlevel 3? I haven't used the rescue disk very much. Will it mount > > > everything in /etc/fstab rw or will i have to do this manual? > > > > It'll mount the partitions using the options specified in fstab I > > believe (I may be wrong though - I hardly ever use the rescue disk). > > > > I'd suggest making the partition on the new disk the same size or bigger > > than the old root partition and then using "dd" to copy the actual > > partition across rather than mounting the filesystem and using a regular > > copy tool. This will ensure that an exact copy is made. You can then use > > resize2fs to expand the new root filesystem to fill its partition, and > > tune2fs to change the filesystem label - otherwise you'll have two > > filesystems labelled "/", which will confuse the kernel. > > > > dd is IMHO a bad option. It makes an EXACT image of the partiton named, > including the size of the partition. For example, "dd if=/dev/hdc1 > of=/dev/hdd2" will create a partiton content of hdd2 that is exactly, > bit for bit, an image of the original. Then the extra steps of resizing > and relabeling are required. It also copies every byte of the source, > whether data is there or not, which is inefficient on a filesystem that > has a significant amount of free space. It's true that dd would copy the empty space too. However, it would be so much faster that I'd wager that in most cases where the filesystem isn't less than say 30% full dd would still be faster than cp because it doesn't have to navigate the filesystem, issue system calls to get each file or directory's owner, permissions, last-modified times etc. and then set them on the copy. > Why not use "cp -a" since that will copy everything, recursively, and > will retain all the filesystem permissions, (it is after all designed to > make an archive copy). It does require that the new filesystem be > already formatted, but that is simple and likely already done anyway. > It does not require relabeling the partition either. A single command > instead of at least 3 as you list above. Starting from rescue mode (we're copying the root partition remember), with the new partition created: dd method: - run dd to copy data - run resize2fs to fix up partition size - run tune2fs to set label cp method: - run mkfs to create new filesystem and set label - mount old and new filesystems (not needed for dd) - run cp to copy data Moreover, "cp -a" will copy the data from all mounted filesystems under the starting point, so if you've mounted all original filesystems (the rescue CD would offer to do that), you'd potentially be copying more than just the original partition. The dd method does not have this issue. > I am a fan of doing things in the simplest and most efficient way > possible. Me too :-) Paul. -- Paul Howarth <paul@xxxxxxxxxxxx>