LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 03-08-2011, 12:28 PM   #1
Ulysses_
Member
 
Registered: Jul 2009
Posts: 650

Rep: Reputation: 42
How do I copy /dev/* from filesystem to filesystem


If a partition only contains data files one can simply copy every file to another partition of another filing system and size.

But if the partition contains /dev/*, symbolic links and other special files, how do you copy everything to another partition of a different filing system and size?
 
Old 03-08-2011, 12:39 PM   #2
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
You can exclude the /dev/ and other "special" files. As far as the symbolic links, depending on what kind of file it is pointing to, you can copy the links over, but that's if the files that are being linked to are in within the backup.
 
Old 03-08-2011, 12:40 PM   #3
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,411
Blog Entries: 1

Rep: Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115Reputation: 1115
Why are you trying to copy /dev/?
 
Old 03-08-2011, 01:14 PM   #4
Ulysses_
Member
 
Registered: Jul 2009
Posts: 650

Original Poster
Rep: Reputation: 42
Because I want to change filing system (xfs to ext3), resize, defrag and shrink (vmware concept) in one go.
 
Old 03-08-2011, 01:17 PM   #5
corp769
Guru
 
Registered: Apr 2005
Posts: 5,814

Rep: Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001Reputation: 1001
Quote:
Originally Posted by Ulysses_ View Post
Because I want to change filing system (xfs to ext3), resize, defrag and shrink (vmware concept) in one go.
You can't just do that. You need to set all of that up before you copy your files over.
 
Old 03-08-2011, 01:22 PM   #6
Ulysses_
Member
 
Registered: Jul 2009
Posts: 650

Original Poster
Rep: Reputation: 42
Please answer the question in the title and do not diverge. Not possible to copy /dev/random and /dev/zero from XFS to a blank EXT3?
 
Old 03-08-2011, 02:08 PM   #7
jcalzare
Member
 
Registered: Aug 2009
Location: Chicago
Distribution: CentOS
Posts: 114

Rep: Reputation: 34
You can use rsync with the --links flag, which will copy simlinks, though your system is likely to be broken if you are trying to migrate filesystems by simply copying /dev.

Last edited by jcalzare; 03-08-2011 at 02:09 PM.
 
Old 03-08-2011, 02:57 PM   #8
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096
Quote:
Originally Posted by Ulysses_ View Post
Please answer the question in the title and do not diverge.
Quote:
How do I copy /dev/* from filesystem to filesystem
You don't. The files in /dev are created at boot.
Besides that, just copying your files from one system to another won't work. You have to keep this in mind:
1. If your system uses UUIDs you have to change them on the new system.
2. You have to reinstall the bootloader.
3. If you don't have a /boot-partition be aware that your bootloader must support XFS.
 
Old 03-08-2011, 03:55 PM   #9
Ulysses_
Member
 
Registered: Jul 2009
Posts: 650

Original Poster
Rep: Reputation: 42
What if I install the same linux distro to a smaller EXT3 partition, delete everything but /dev in this, and then copy everything but /dev from the old XFS partition using cp? Bootloader supports XFS.

Last edited by Ulysses_; 03-08-2011 at 04:00 PM.
 
Old 03-08-2011, 04:04 PM   #10
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096
Sorry, I misread your post, I thought you want from ext3 to XFS, not from XFS to ext3.
But the problems are the same:
1. After the copy you have to reinstall the bootloader.
2. If you use UUIDs you have to change your fstab on the new system.

Copying over a new installed system will bring exactly nothing, the new files will be overwritten with the old and you have the same problems as mentioned above.
In reality adapting a copied system is a trivial task, just copy it with rsync to the new partition, and exclude /dev, /sys and /proc. Then create this directories with a simple mkdir on the new partition, adapt your /etc/fstab according to the new UUIDs, chroot into the new system and reinstall the bootloader.
If you search LQ or the web you should find plenty of HowTos regarding the cloning of a system with rsync.
 
Old 03-08-2011, 04:27 PM   #11
Ulysses_
Member
 
Registered: Jul 2009
Posts: 650

Original Poster
Rep: Reputation: 42
Quote:
Originally Posted by TobiSGD View Post
Sorry, I misread your post, I thought you want from ext3 to XFS, not from XFS to ext3.
But the problems are the same:
1. After the copy you have to reinstall the bootloader.
2. If you use UUIDs you have to change your fstab on the new system.

Copying over a new installed system will bring exactly nothing, the new files will be overwritten with the old and you have the same problems as mentioned above.
Aren't the problems above eliminated if /etc/fstab, /dev, /sys and /proc are kept as in the fresh install and everything else is copied with rsync or cp? The tasks you mention like installing a bootloader under chroot etc seem risky and definitely not trivial to my level.
 
Old 03-08-2011, 04:42 PM   #12
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,653
Blog Entries: 2

Rep: Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096Reputation: 4096
Quote:
Originally Posted by Ulysses_ View Post
Aren't the problems above eliminated if /etc/fstab, /dev, /sys and /proc are kept as in the fresh install and everything else is copied with rsync or cp? The tasks you mention like installing a bootloader under chroot etc seem risky and definitely not trivial to my level.
It depends on your partitioning. If you use more than one partition, like a separate /home-partition, you have to give it to your new system also as /home-partition. Be sure to not format it accidentally at install time.
By the way, I don't think that copying a system to a newly installed one is more trivial than re-installing the bootloader.
 
Old 03-09-2011, 10:53 PM   #13
Ulysses_
Member
 
Registered: Jul 2009
Posts: 650

Original Poster
Rep: Reputation: 42
Found a tool that seems to include /dev/* in its copies, it's rsync with the -avH options and it seems to have worked, except it does not copy the master boot record or the system partition's boot record.

How do you install the bootloader then, is there a liveCD for just this task?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filesystem for /dev MQMan Slackware 3 03-22-2009 02:49 PM
Confusing USB Filesystem Problem (Can't Wipe Ext3 Filesystem) dkaplowitz Linux - Hardware 3 04-14-2007 07:30 PM
DISCUSSION: Virtual Filesystem: Building a Linux Filesystem from an Ordinary File mchirico LinuxAnswers Discussion 0 10-28-2004 11:35 PM
Encrypted Root Filesystem HOWTO and /dev filesystem tmillard Linux From Scratch 0 10-18-2004 04:58 PM
Ethernet and the /dev filesystem Citizen Bleys Linux - Software 4 11-25-2003 07:25 AM


All times are GMT -5. The time now is 05:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration