Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: Can't delete or copy files from external hard drive

  1. #11
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Can't delete or copy files from external hard drive

    Try:
    Code:
    sudo cp /media/brent/Elements/Lubuntu20^04_backups/2021-04-03-18-img_Lubuntu_aftrLowLtcy/sdb1.vfat-ptcl-img.gz.aa /home/brent
    But this probably isn't a good idea. Grabbing just one of those files isn't really useful. You need them all to make the sdb1 "block" file which could be mounted by root and accessed. If struggling with Unix permissions, manually merging all those .aa, .ab. .ac .... files isn't something you want to tackle without using clonezilla's recovery features.

  2. #12
    Join Date
    Apr 2014
    Beans
    85

    Re: Can't delete or copy files from external hard drive

    Quote Originally Posted by TheFu View Post
    You call that a problem, but it isn't. Those are compressed clones of all the files at the block-level for the partition, split into specific sizes. Partitions aren't available for the world read for a good reason. There isn't any use in you having access to those files, unless your goal is to delete them. If that's the goal, you'll want to delete the entire directory. Use sudo rm for that. Be EXTREMELY careful, since a mistake with that command almost ways WILL BE TERRIBLE.

    If you want to copy the files, use sudo as well and leave them owned by root, so you know to be extra careful with those block files.
    Okay, thanks for the insight. I would only ever manipulate these files for two purposes:


    • Deleting an out-of-date backup disk image (the entire Clonzilla-created folder containing all the files related to the disk image) so I can free up space on the hard drive to make a new updated disk image or
    • To copy that folder containing all files related to the disk image off the drive to a secondary USB backup drive.


    I would never have a reason to access the files individually. I would only ever be deleting the entire folder created by Clonezilla which contains all the files for a particular disk image.

    Could you give me an example of a sudo rm and sudo cp command so that I can make sure I'm doing it right. I know it might seem pedantic of me to ask, but since I am new to this and I don't want to royally mess things up, I wouldn't mind learning by starting at the basics.
    i.e. what would be the commands to copy or delete a folder containing the Clonezilla image if that folder was:

    /media/brent/Elements/Lubuntu20^04_backups/2021-04-04-16-img_Lubuntu/


    Also, I would like to understand why this is happening. Do I not have ownership of these folders, as suggested by a poster in a message above? Who has ownership of the folders then? The Clonezilla Live DVD "user"?

    I wonder: if I booted the computer with the Clonezilla Live DVD, and choose to enter a console/terminal/command line within that session, would I have ownership of these folders/files on the external USB hard-drive?
    Last edited by Brent_Santin; April 5th, 2021 at 01:14 AM.

  3. #13
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Can't delete or copy files from external hard drive

    Quote Originally Posted by Brent_Santin View Post
    I wouldn't mind learning by starting at the basics.
    Post #2 has links to understand "the basics" of permissions. It doesn't appear that you've worked through those. Please do so. There is a simple elegance to it.

    Quote Originally Posted by Brent_Santin View Post
    Also, I would like to understand why this is happening. Do I not have ownership of these folders, as suggested by a poster in a message above? Who has ownership of the folders then? The Clonezilla Live DVD "user"?
    They are owned by root - just like the output shows. Work through the links in post #2!

    Quote Originally Posted by Brent_Santin View Post
    I wonder: if I booted the computer with the Clonezilla Live DVD, and choose to enter a console/terminal/command line within that session, would I have ownership of these folders/files on the external USB hard-drive?
    Root would have ownership. I don't use clonezilla, but I can't imagine any way that it doesn't run as root. Most backup tools have to run as root to be effective in multi-user environments like Linux. Think multi-user. A user does not equal a human.

    http://linuxcommand.org/tlcl.php has all the stuff you seem to be trying to skip, but it is very important to know. Almost any Unix book would cover permissions. All Unix is the same when it comes to permissions. OSX, Linux, Unix, iOS, Android .... all the same.

    Good luck to you.

  4. #14
    Join Date
    Apr 2014
    Beans
    85

    Re: Can't delete or copy files from external hard drive

    Okay, I think I have a theory as to what has happened. Look at this directory listing on my external USB backup hard-drive:

    Code:
    brent@tower-i5:/media/brent/Elements/Lubuntu20^04_backups$ ls -l
    total 24
    drwxr-xr-x 2 root  root  4096 Apr  3 07:59 2021-04-03-11-img_Lubuntu_b4LowLtcy
    drwxr-xr-x 2 root  root  4096 Apr  3 14:40 2021-04-03-18-img_Lubuntu_aftrLowLtcy
    drwxr-xr-x 2 root  root  4096 Apr  4 13:11 2021-04-04-16-img_Lubuntu
    drwxrwxrwx 2 brent brent 4096 Mar 28 10:04 Lubuntu_FreshInstall_bkp_img
    drwxrwxr-x 3 brent brent 4096 Mar 28 11:10 Home_rsync_bkp
    -rwxrwxrwx 1 brent brent  935 Mar 28 09:57 read-me.txt
    All of the folders that have the word "Lubuntu" in them are "backup images" of my computer's internal hard-drive created with Clonezilla. They were done at various dates and times while I was setting up my new computer and wanted to preserve the state of the drive just before I was about to do something that could potentially mess up the system.

    The first one I did on March 28th, just after doing a fresh installation of Lubuntu (folder "Lubuntu_FreshInstall_bkp_img"). Now the key here is that I did that one while the external backup USB drive was still formatted with the NTFS file system. You will notice that it has the ownership "brent". I believe this is because it was an NTFS drive at the time. I should note that that folder gives me no problems. I can move, copy and delete it or anything within it.

    A little while later I wanted to do an "rsync" backup of my home directory to the same external drive. However, I read online that it was better if the destination drive was formatted with the ext4 file system, so to preserve the special Linux-legal filenames, date stamps, permissions, etc. So at that point I moved the folder "Lubuntu_FreshInstall_bkp_img" OFF the external USB drive and onto my computer's internal hard-drive. I then reformatted the external drive to EXT4 file-system. Finally, I returned "Lubuntu_FreshInstall_bkp_img" BACK onto the external USB drive.

    Following this I performed the rsync backup of my home directory to the external drive, which you see as a folder called "Home_rsync_backup". This folder, too, gives me no trouble as it has ownership by "brent". I can move files off and on, etc. without problem.

    All subsequent Clonezilla images of my computer's drive were save to the external USB hard-drive that had now been formatted with the EXT4 filesystem. These are all the other folders with "Lubuntu" in their names --- and all of them have ownership "root"! I believe this is because the EXT4 filesystem allows Clonezilla to assign (preserve?) ownership of those folders as "root" and not "brent" (something the NTFS filesystem had previously not permitted - or rather stripped away?).

    So as "root" owned folders, I would of course have restricted permissions regarding them if I simply plugged the drive into a session where I was logged in as user "brent". I could not manipulate these root owned folders because of this.

    The reason I was so surprised by this behaviour was that during my previous five years of using Clonezilla, I had only ever used it with an NTFS formatted external hard drive. Therefore I had never encountered this automatic "root" assignment of folders created by Clonezilla before.

    I think I finally understand why it happened. Does my theory make sense?
    I'm still learning about user-permissions in Linux, so please forgive me if this is all basic stuff. It is a revelation for me.
    Last edited by Brent_Santin; April 5th, 2021 at 02:51 AM.

  5. #15
    Join Date
    Nov 2007
    Location
    London, England
    Beans
    7,287
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: Can't delete or copy files from external hard drive

    You are indeed getting the hang of it. Clonezilla runs as root - it has to because only root has the ability to read all the things that are root owned, and you don't want clonezilla to omit things when making a backup.I'm not familiar with clonezilla, but if it is making block-level backups, then is is reading root-only raw disk device interface "files" in /dev. Because it's running as root, the backup files it creates are owned by root.

    ntfs cannot store Linux file permissions properties, so yes, it "strips" them. The ownership information is lost.

    If you want to copy or edit files that are only readable/writeable by root, prefix the command with "sudo". People often say sudo is "super user do...". It is a direct equivalent of Windows "run as administrator...".

    Note the drwxr-xr-x permission markings in the listing. Learing what these mean is a must. It's not that hard, and you will always struggle until you know them. This link http://linuxcommand.org/tlcl.php that TheFu gives is an excellent resource, but don't try to learn it all because your head will explode. I recommend that you use it for reference and remember the bits that you have to look up that you think will come in handy again. I know some bits well, and I'm sure there are things in there that I don't even know exist.

  6. #16
    Join Date
    Jun 2014
    Beans
    6,270

    Re: Can't delete or copy files from external hard drive

    Windows ntfs filesystem have no concept or understanding of Linux permissions such as "rwx" but rather use default setting with umask, dmask and fmask. Depending upon those settings, it could be possible for anyone with access to your machine to modify and delete the file on the ntfs partitions.

  7. #17
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Can't delete or copy files from external hard drive

    There is no way to change from NTFS-->ext4 without formatting that is destructive, so any files or directories on the NTFS partition would be wiped - gone - removed - as part of the process to change to any other file system. In short, none of the files that were on the NTFS file system made it to the ext4 file system. So that guess for what happened isn't possible.

    Human does not equal userid. Think multi-user. Whatever useid a process runs under, that's the owner for any files created by that process (except on NTFS or other file systems that do not support POSIX permissions).

  8. #18
    Join Date
    Apr 2014
    Beans
    85

    Re: Can't delete or copy files from external hard drive

    Thanks guys. I was able to copy the files I needed off the drive and delete the out of date backup disk images using "sudo rm" and "sudo cp".
    I read the documents linked to and now understand how file permission flags work in Linux.
    So thank you. I've come out of this experience knowing more than I did when I started this will help me in the future when using Linux.
    All the best!

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •