-   Slackware (
-   -   Move Slack to Another Partition (

AxXium 07-13-2005 01:12 PM

Move Slack to Another Partition
I want to move Slackware to a different partition on the same hard drive.

My partition scheme looks like this.

hda1 / 10 GB
hda2 /linuxswap 1GB
hda3 /home 19.5 GB
hda4 /usr/local 19.5 BD

Total of 60 GB

I want it to look like this

hda1 /extra1 10 GB
hda2 /linuxswap 1GB
hda3 / 19.5 GB
hda4 /extra2 19.5 GB

It should only be a matter of...

1. [To move /home] mkdir /dev/hda1/home
2. [To move /usr/local] mkdir /dev/hda1/usr &
mkdir /dev/hda1/usr/local &
them move the files.
3. Finally copy / to hda3.
4. Edit /etc/fstab
5. Edit /etc/lilo.conf
6. run /sbin/lilo

Does that look correct to you guys?

Reason why such a drastic change?

1. I want to reformat hda1 to Reiser4 and move Slack on that later.
2. I want to install LFS 6.1 to hda3 or hda4

P.S. I do have a second 60 GB installed where everything is backed up to btw.

Let me know
Thanks :)

Ilgar 07-13-2005 01:41 PM

I did something like this recently. Looks OK to me. Just don't forget to preserve ownership and permissions when moving/copying (it was cp -p for copying I think...).

Boow 07-13-2005 01:54 PM

I think you want mkdir /mnt/hda1

cp -ax will get the job done you want to exclude other filesystems like /proc /sys and /mnt you can recreate those directorys

just remember to edit your fstab to reflect changes

AxXium 07-13-2005 02:09 PM

Thanks for the nice cp tip guys. After reading your replies I visited the man page for cp.

It reads...


cp - copy files and directories 
cp [OPTION]... --target-directory=DIRECTORY SOURCE... 

Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.

-a, --archive
    same as -dpR
    make a backup of each existing destination file
    like --backup but does not accept an argument
    copy contents of special files when recursive
    same as --no-dereference --preserve=link
    never follow symbolic links
-f, --force
    if an existing destination file cannot be opened, remove it and try again
-i, --interactive
    prompt before overwrite
    follow command-line symbolic links
-l, --link
    link files instead of copying
-L, --dereference
    always follow symbolic links
    same as --preserve=mode,ownership,timestamps
    preserve the specified attributes (default: mode,ownership,timestamps), if possible additional attributes: links, all
    don't preserve the specified attributes
    append source path to DIRECTORY
    same as `--no-dereference'
-R, -r, --recursive
    copy directories recursively
    remove each existing destination file before attempting to open it (contrast with --force)
    specify how to handle the prompt about an existing destination file
    control creation of sparse files
--strip-trailing-slashes remove any trailing slashes from each SOURCE
-s, --symbolic-link
    make symbolic links instead of copying
-S, --suffix=SUFFIX
    override the usual backup suffix
    move all SOURCE arguments into DIRECTORY
-u, --update
    copy only when the SOURCE file is newer than the destination file or when the destination file is missing
-v, --verbose
    explain what is being done
-x, --one-file-system
    stay on this file system
    display this help and exit
    output version information and exit

By default, sparse SOURCE files are detected by a crude heuristic and the corresponding DEST file is made sparse as well. That is the behavior selected by --sparse=auto. Specify --sparse=always to create a sparse DEST file whenever the SOURCE file contains a long enough sequence of zero bytes. Use --sparse=never to inhibit creation of sparse files.

The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values:

none, off
    never make backups (even if --backup is given)
numbered, t
    make numbered backups
existing, nil
    numbered if numbered backups exist, simple otherwise
simple, never
    always make simple backups

As a special case, cp makes a backup of SOURCE when the force and backup options are given and SOURCE and DEST are the same name for an existing, regular file. 
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering. 
Report bugs to <>. 
Copyright 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
The full documentation for cp is maintained as a Texinfo manual. If the info and cp programs are properly installed at your site, the command

    info coreutils cp

should give you access to the complete manual.

It seams as though cp -a copies it exactly with all the permissions and everything.

Again, Thanks!

freakyg 08-21-2005 03:16 AM

I've had to move my LFS install once or twice........I used this.......

cp -Rav

LiNuCe 08-21-2005 04:28 AM


Ilgar : I did something like this recently. Looks OK to me. Just don't forget to preserve ownership and permissions when moving/copying (it was cp -p for copying I think...).
To make an exact copy of a directory hierarchy, I prefer to use the good old GNU Tar command. I think it is the easiest and safer solution. For example, to copy /usr/ to /mnt/hdax/usr/ with GNU Tar, I would use :

$ su - root
# ( cd / ;  tar cf - usr ) | tar xpf - -C /mnt/hdax/

-- LiNuCe

Xian 08-21-2005 07:31 AM

You can use rsync:
# rsync -rav /directory/path/ /mnt/directory/

Or if you prefer the cp command:
# cp -rpfd /directory/path/* /mnt/directory/

LiNuCe 08-21-2005 08:14 AM

Asterisk character, hidden files and filename expansion rules of the shell

(...) Or if you prefer the cp command:
# cp -rpfd /directory/path/* /mnt/directory/
The asterisk character ("*") should be used carefully as it is subject to the filename expansion rules which are applied by the shell before the command is executed. In the above example, hidden files (.*) in the /directory/path/ directory won't be copied as BASH does not include hidden files when it expands the asterisk character. Since an example is worth a thousand words : look at the output of the folllowing command and notice that hidden files/directories are not listed :

$ cd $HOME
$ echo *

-- LiNuCe

Xian 08-21-2005 08:40 AM

Yes, that is correct and a good point. You should not use the '*' in the cp command if you have hidden files in that immediate path. It will of course copy over hidden files but they would need to be nested.

For example:


# ls -a /home/Test/Hidden
.  ..  .a  .ab  .abc  .abcd  .abcde
# ls -a /home/Test2
.  ..
# linux:/home# cp -rpfd /home/Test/* /home/Test2/
# linux:/home# ls -a /home/Test2/Hidden
.  ..  .a  .ab  .abc  .abcd  .abcde

All times are GMT -5. The time now is 10:54 AM.