Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to transfer a working Linux installation to a new larger disk, so I've attached the new disk on a USB port, partitioned it and created filesystems. While copying all the files over I hit a snag on the /dev directory. "cp -a" does most of the job, but fails on e.g. /dev/video0 with "Operation not supported".

>ls -l /dev/video0    # on disk I copy from
crw-rw----+ 1 root video 81, 0 2011-09-25 17:15 video0

>ls -l dev/video0    # on disk copied to
crw-rw---- 1 root video 81, 0 2011-09-25 17:15 video0

So it seems everything was copied except for the "+" at the end of the access-rights field. What does that plus-sign mean and how can I create it on the destination disk?

share|improve this question
add comment

1 Answer

The + at the end indicates the presence of an access control list. An ACL on a file gives additional users or groups specific permissions, in addition to the traditional unix permissions which only distinguish between the owning user, the owning group and others. You can use getfacl to see the ACL on a file and setfacl to set it.

cp -a would copy the ACL if it could. The reason it can't is that the target filesystem doesn't support ACLs or is mounted without ACL support.

Here, this doesn't really matter. /dev isn't an on-disk filesystem anyway, you shouldn't copy it, and likewise you shouldn't copy /proc, /sys and other non-disk filesystems. Run cp -ax to perform a copy without recursing into other filesystems.

cp is often not the best way of transfering an existing installation to a new disk. It would be easier to copy the filesystem wholesale, then enlarge it to fill the target partition. In a nutshell:

cat </dev/sdy1 >/dev/sdz1
resize2fs /dev/sdz1

where /dev/sdy1 is the partition containing the existing installation and /dev/sdz1 is where you want to copy the system on the larger disk. Be very careful when typing this command as this will irrecoverably erase the target partition.

After you've copied the files, you'll need to set up the bootloader on the new disk. grub-install /dev/sdz should do the trick, but you may need to write a /boot/grub/device.map first to convey that the new disk is going to be the primary disk. If you have trouble with that, the easiest (if hardly the most convenient) way is to put the new disk in its final place, then boot from an Ubuntu CD/USB and tell the installation program to repair the bootloader.

share|improve this answer
    
So it'll be ok to leave /dev /proc and /sys as empty directories on the destination disk? All three have a line in /etc/mtab with their own special filesystem. But only /proc is mentioned in /etc/fstab. I don't think copying the filesystem wholesale is a good idea - the new disk is bigger, but the linux root partition will be much smaller - the inode area from the old disk will eat 10Gb and I don't think resize2fs can shrink that. –  Joakim Rosqvist Sep 25 '11 at 21:03
    
@JoakimRosqvist Yes, all three (and more, run cat /proc/mounts to see others) are mounted as part of the boot process. The files you see there aren't stored on the disk, they are generated on-the-fly by the kernel. The entry for /proc in /etc/fstab is a historical survivance, but it's not even necessary. –  Gilles Sep 25 '11 at 21:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.