copy a whole partition excluding specified.


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users copy a whole partition excluding specified.
# 1  
Old 10-08-2009
copy a whole partition excluding specified.

Scenario:

I would want to copy my / to /mnt, and to avoid recursion exclude /mnt.

Code:
cp -avx / /mnt

If i use the above i believe it would run recursively, and end up in mess. So how to do it ?!
Basically this / is sda1, and /mnt is sda2 and sda1 is where only OS is available & currently booted.

Ultimately, my question is how to backup a path, by excluding a specific directory.

I cannot boot in Live CD and copy. Anybody have experience in doing this, and have some efficient way to do this ?
# 2  
Old 10-08-2009
Quote:
Originally Posted by thegeek
I would want to copy my / to /mnt, and to avoid recursion exclude /mnt [...] this / is sda1, and /mnt is sda2
Code:
cp -avx / /mnt

As man cp states, "x" means "stay on this file system" - meaning in turn that the command given ought to suffice.
# 3  
Old 10-08-2009
Yep, cp -avx did the trick.

It is a simple confusion, thanks anyway.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Shrink LVM partition & create new Linux Primary partition

Hello All, I have a Red Hat Linux 5.9 Server installed with one hard disk & 2 Partitions created on it as follows, /boot - Linux Partition & another is LVM - One VG & under that 5-6 Logical volumes(var,opt,home etc). Here my requirement is to take out 1GB of space from LVM ( Any logical... (5 Replies)
Discussion started by: gr8_usk
5 Replies

2. Solaris

Partition overlaps another partition while creating new parition in solaris

hi all while formatting hard disk i am getting following error. Partition 1 ends at 266338338 It must be between 34 and 143374704. label error: EFI Labels do not support overlapping partitions Partition 8 overlaps partition 1. Warning: error writing EFI. Label failed. I have formatted the... (2 Replies)
Discussion started by: nikhil kasar
2 Replies

3. Shell Programming and Scripting

Copy files/directories excluding multiple paterns

my directory structure is like below: basedir\ p.txt q.htm r.java b\ abc.htm xyz.java c\ p.htm q.java rst.txt my requirement is i want to copy all the files and directories... (0 Replies)
Discussion started by: ajayyadavmca
0 Replies

4. Filesystems, Disks and Memory

Using dd to copy a partition.

Here's a conundrum. I use a ThinkPad (T30) which has a slot on the side for the hard drive. It is very easy to swap this with another hard drive which I keep as a backup. Now when I copy the Linux partition from my (in use) hard drive to the backup one (in my UltraBay slot) it takes only 30... (0 Replies)
Discussion started by: newyorkpaulie
0 Replies

5. Shell Programming and Scripting

Enhanced partition copy script (new & improved!)

This is now a larger script than I would customarily post. But many folks have become accustom to getting it off this forum. Every couple of years I update my favorite scripts. This script is one that I use regularly and have posted older versions every couple of years. I noticed that it has... (3 Replies)
Discussion started by: jwzumwalt
3 Replies

6. UNIX for Advanced & Expert Users

Copy Structure excluding some folders

Hi I want to copy the structure from one place to another. -> cd /hol/; -> find . -type d | cpio -pvdm /abc/cat; while copying the structure I want to exclude some directories like test1 and Test. I have read somewhere that this can be done with -prune option. Could anyone... (2 Replies)
Discussion started by: soumodeep123
2 Replies

7. UNIX for Dummies Questions & Answers

Copy Directories excluding files

Hi guys, I want to copy folder and sub folders only. I don't want the files. If i use cp -r command it will copy entirely with files. Could any one suggest me. Thanks in advance (1 Reply)
Discussion started by: karthik82
1 Replies

8. Filesystems, Disks and Memory

DD copy excluding empty blocks?

I'm not 100% sure if this was the right place to post in but here i go: I'm attempting to migrate a physical windows disk onto my SAN through the use of the dd copy command. I'm booting into knoppix, running dd, and then bringing the server back up into windows running on the SAN. Everything... (2 Replies)
Discussion started by: Merkilo
2 Replies

9. UNIX for Dummies Questions & Answers

I've created a partition with GNU Parted, how do I mount the partition?

I've created a partition with GNU Parted, how do I mount the partition? The manual information at http://www.gnu.org/software/parted/manual/parted.html is good, but I am sure about how I mount the partition afterwards. Thanks, --Todd (1 Reply)
Discussion started by: jtp51
1 Replies

10. Gentoo

How to copy single partition?

I presently backup my multi-OS multi-paritition boot drive (fedora core 4/ext3, WinXPServer/NTFS, WinXPHome/FAT32) with the command: telinit 1; cp /dev/sda /dev/sdb And this works. Is there a command to only copy a single partition instead of an entire device? And what about the grub... (12 Replies)
Discussion started by: siegfried
12 Replies
Login or Register to Ask a Question