Gianmarco Giovannelli
2006-Jan-26 23:19 UTC
cpdup, chflags and ext2fs: undeletable forever :-)
Hi, I have a little problem with chflags and ext2fs partition. My env is : # uname -a FreeBSD multimedia.giovannelli.com 6.0-STABLE FreeBSD 6.0-STABLE #0: Sat Jan 21 22:55:27 CET 2006 gmarco@multimedia.giovannelli.com:/usr/obj/usr/src/sys/FREEBSD i386 I have mounted an ext2fs disk rw and I used part of it for storing a "snapshot" of my / fs. Something like: # mount -t extfs /dev/ad1s1 /mnt/ad1 # mkdir /mnt/ad1/chroot # cpdup -vv / /mnt/ad1/chroot Obviusly cpdup trying to reproduce all the permissions of the srcs file, so also the special flags schg,uchg of some files. The problem is that cpdup was able (or at least seems to be able to set them) but I am not able anymore to remove them :-) So these files are not deletable anymore. One of this file (i.e. rcp) looks in this way: multimedia:/bin# ll -lo rcp -r-sr-xr-x 1 root wheel schg,uchg 18332 Jan 21 09:37 /bin/rcp The copy on the ext2fs look in these other way: multimedia:/mnt/ad1/chroot/bin# ll -lo rcp -r-sr-xr-x 1 root wheel - 18332 Jan 27 07:55 rcp If I try: multimedia:/mnt/ad1/chroot/bin# chflags noschg rcp multimedia:/mnt/ad1/chroot/bin# chflags nouchg rcp multimedia:/mnt/ad1/chroot/bin# chmod 777 rcp multimedia:/mnt/ad1/chroot/bin# ll -lo rcp multimedia:/mnt/ad1/chroot/bin# ll -lo total 20 -rwxrwxrwx 1 root wheel - 18332 Jan 27 07:55 rcp multimedia:/mnt/ad1/chroot/bin# rm -f rcp rm: rcp: Operation not permitted Even running a live linux distro by cdrom seems to be able to remove them anymore giving a strange error 30. Any idea ? I have tried also the obliterate utility from ports which seems able to remove files on ro volume without any results. Probably the only solutions is to newfs the volume but : multimedia:/mnt/ad1/chroot/bin# df -h Filesystem Size Used Avail Capacity Mounted on /dev/ad1s1 275G 254G 7.2G 97% /mnt/ad1 Any idea/tips to remove this folder ? Probably we have to deny the chflags on volume others than ufs even if we can mount them rw ? Best Regards, Gianmarco Giovannelli , "Unix expert since yesterday" http://utenti.gufi.org/~gmarco/