Best way to copy /usr to different partition?
Kevin J. Cummings
cummings at kjchome.homeip.net
Fri Dec 7 03:43:01 UTC 2007
Daniel B. Thurman wrote:
> I was getting dangerously close to running out of disk space
> since /usr was filling up fast.
>
> I thought it was simple to tar-copy /usr to a different drive/partiton
> using tar copy such as:
>
> (cd /usr; tar cpf - .) | (cd /newpartition; tar xpf -)
using tar doesn't copy the extended attributes used by SELinux. Have
you relabeled the drive? ( touch /.relabel ; reboot )
> I tar copied the contents of /usr into my new drive/partition
> and I changed the partition label to /usr, updated my
> /etc/fstab file, renamed my /usr to /usr-b, created
> an empty directory /usr, chmod it to 775, mounted
> /usr - and it all looked fine. I then unmounted /usr,
> and then rebooted.
>
> The reboot reported that there was a problem with
> the two library files: somelibfile.so.1 and somelibfile.so.2
> and then gnome came up with user/password screen.
>
> I logged in as a normal user, and after that point, I a
> black screen came up with the gnome-X-cursor and
> then stopped. Nothing worked at this point.
>
> I then rebooted using rescue CD, and examined the
> messages log file and it appears that selinux reported
> all sorts of AVC denied over /usr and other non-system
> mounted filesystems.
>
> Clearly, it seems that selinux is having problems.
So relabel the drive.
> I suppose I can reboot setting the selinux = 0 and then
> begin the task of somehow repairing selinux tags in all
> of my files? Does this make any sense?
>
> Anyone have a better solution?
>
> I could reverse the /usr process and get rename /usr-b
> and comment out the /usr from my fstab, but I wanted
> some input from member in this forum before attempting
> to do that - I would end up back to my original disk-space
> problem.
>
> Any advice?
When I started looking into backups after SELinux, the recommendation
was to use "star" instead of "tar" and to have it copy the extended
attributes as well.
>From by backup script:
> # Use star instead of tar to capture the SELinux attributes
>
> TAR=star
>
> # Write archive to this file
> # Use f=tarfile to write to tarfile
> # Leave empty to write to sdtout
>
> TARFILE=root
> STAR_COMPRESS_FLAG=-9
>
> # -c create a star archive
> # -bz compress with bzip2
> # -C / to backup files starting from /
> # -H=exustar format is required to store SELinux attributes
> # -M do not descend mount points
> # ignore -multivol for now
> # -P allow partial last record
> # -vv increase verbosity and list files being archived
> # -xattr to archive SELinux attributes
>
> OPTS="-c - -bz -C / -H=exustar -M -P -vv -xattr"
>
> $TAR $OPTS $FS | split -d -b $SPLITSIZE $TARFILE
I'm compressing and writing to DVDs, so you night not need all of the
options or the split pipe that I use.
--
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)
More information about the fedora-list
mailing list