I am trying to copy data back onto an sd card with an ext2 type partition whilst preserving the ownership and permissions. I use the following command:

sudo cp -va --preserve=all 2nd/. /media/malapradej/AB6E-FC7F/

I get an error:

‘2nd/./dalvik-cache/arm/data@app@air.uk.co.bbc.android.mediaplayer-1@base.apk@classes.dex’ -> ‘/media/malapradej/AB6E-FC7F/./dalvik-cache/arm/data@app@air.uk.co.bbc.android.mediaplayer-1@base.apk@classes.dex’
cp: failed to preserve ownership for ‘/media/malapradej/AB6E-FC7F/./dalvik-cache/arm/data@app@air.uk.co.bbc.android.mediaplayer-1@base.apk@classes.dex’: Operation not permitted

According to this site this may be due to the extended attribute set of the sd card. The lsattr /media/malapradej/AB6E-FC7F/ command shows:

lsattr: Inappropriate ioctl for device While reading flags on /media/malapradej/AB6E-FC7F/dalvik-cache

According to this site I need to remount the sd card partition using:

sudo mount -o remount,user_xattr /media/malapradej/AB6E-FC7F/

But I get the same error and permissions and ownership is not retained.


It was all down to operator error. The file system I was trying to copy to was not ext2 in the end but FAT32. I did a mount -l and found:

/dev/sdb1 on /media/malapradej/AB6E-FC7F type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,user_xattr,uhelper=udisks2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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