I have an Ubuntu server where I'm automounting an external hard drive each boot.  To do this, I've created an empty folder on the root partition, and the drive gets mounted "inside" this folder.  However, what if I perform a backup to this path when the drive isn't properly mounted? The backup would instead fill up my root partition!  I can ensure that the drive is mounted each time by performing:  sudo mount -a   ... before each backup.  However, what are the best practices to ensure that data is never written to the empty mount-folder (except when the external hard drive is truly mounted)?  Can this be solved without scripting? Say with permissions for example? What are the best practices?
1886
Running Cronjob @reboot returns that file on nfs share does not exist.  Example  @reboot python /abs/path/to/script.py   mail from crontab on startup reads "more or less"  /usr/bin/python can't open file "/abs/path/to/script.py": [Error No. 2] No such file or folder.   Script can be run from the command line with no trouble.. Theory is that the cronjob is running before mount has been run. The questions.   Is this theory correct? Is there a way to force the job to wail until the drive has been mounted? .... Other than just putting in a sleep 60 into the command. ;) I tried that already, but it's hit and miss and I need the script to run 100% of the time quickly.
76242
Sometimes I unplug my usb drive only to find out files were not written to it.   I suppose the only way to ensure files are written to it is to right click on the USB drive on the desktop and then select "un-mount", but sometimes I forget.  What is the best way to ensure files are written to the USB drive instantly? This way I can remove the USB drive as soon as I notice the LED light on the USB drive stopped blinking.  OS: CentOS 6
14440
Since some time I am unable to create file/folder on root. I always log in as root and was able to work properly. My experience is as follows: # pwd /root  # mkdir xcxcx mkdir: cannot create directory `xcxcx': No space left on device  # df -h Filesystem      Size  Used Avail Use% Mounted on /dev/sda1        41G  4.1G   35G  11% / /dev/sda3        91G   36G   51G  42% /home /dev/sda2        99G  3.4G   91G   4% /usr  I see ample space on my system; so why am I not able to create folder/files? Update: df -i  reports Filesystem   Inodes    IUsed    IFree IUse% Mounted on /dev/sda1   2681728  2681728        0  100% / /dev/sda3   6037504   111043  5926461    2% /home /dev/sda2   6553600   146034  6407566    3% /usr  Have I run out of inodes? If so, then how do I correct it?
115938
I am a novice linux/Ubuntu user who is just discovering the joys of a lightweight, free software environment which gives control to the user.   To protect some of my data (photos) from the rigours of OS crashes/reinstallation etc. I have created a small storage partition on my primary hard disk using gparted at /dev/sda3 using the ext4 filesystem.   On startup the partition auto-mounts to /media/chris/photo storage. I can see the drive at this location, and in the Unity launcher.   The only problem is I have no permissions to use the 'drive' and hence cannot copy files into it, add folders or in fact do anything in the storage area. My question is how to I give myself permissions within my normal Ubuntu account to use it?  Best Regards,   Chris
35681
So I have unmounted a usb external hard drive but I went to re-mount it.  Is there a command that I can use to remount the drive?  Only way I know to re-mount a drive is to disconnect the usb cable from my Mac and reconnect it.
120743
There are many questions on automatically mounting or problems encountered during mounting that I've read here. But none on how to manually mount a partition.
88969
An external 3½" HDD seems to be in danger of failing — it's making .  I've acquired a replacement drive, and want to know the best strategy to get the data off of the dubious drive with the best chance of saving as much as possible.  There are some directories that are more important than others.  However, I'm guessing that picking and choosing directories is going to reduce my chances of saving the whole thing.  I would also have to mount it, dump a file listing, and then unmount it in order to be able to effectively prioritize directories.  Adding in the fact that it's time-consuming to do this, I'm leaning away from this approach.  I've considered just using dd, but I'm not sure how it would handle read errors or other problems that might prevent only certain parts of the data from being rescued, or which could be overcome with some retries, but not so many that they endanger other parts of the drive from being saved.  I guess ideally it would do a single pass to get as much as possible and then go back to retry anything that was missed due to errors.  Is it possible that copying more slowly — e.g. pausing every x MB/GB — would be better than just running the operation full tilt, for example to avoid any overheating issues?  For the "where is your backup" crowd: this actually is my backup drive, but it also contains some non-critical and bulky stuff, like music, that aren't backups, i.e. aren't backed up.  The drive has not exhibited any clear signs of failure other than this somewhat ominous sound.  I did have to fsck a few errors recently — orphaned inodes, incorrect free blocks/inodes counts, inode bitmap differences, zero dtime on deleted inodes; about 20 errors in all.  The filesystem of the partition is ext3.
95720
I have an external USB 3 disk drive (2TB capacity) that is most likely going to be moved from machine to machine. The disk has a GUID partition table and an ext4 partition. I am unable to write to the disk unless I elevate the process (sudo).  As of now I am thinking of trying one or both of the following and would like to know the cons of each -   chmod 777 /mnt/externalDrive chown nobody:nogroup /mnt/externalDrive   If I give 777 permission and user1 (UID:1005) writes to it and I later move the disk to another computer where user7 is UID:1005, what happens? Does user7 become the owner of the file on that computer? It seems to me that I will periodically have to run chown -R nobody:nogroup /mnt/externalDrive on the disk.  Is any of what I am considering an obvious bad practice? The disk will most likely contain videos, music and pictures none of it need to be protected like some financial data.
35843
I ran into something a couple of weeks ago that I'd never seen before: A filesystem (ext3 I believe) installed to a storage device without a partition. In essence /dev/sdb was the entire filesystem. I know many filesystems can be extended into empty space, so doing this allows extending without dealing with LVM or some other kind of volume manager, but are there any other advantages for setting up storage this way?  The specific case I saw was as the ephemeral data volume for a number crunching server, the boot and root volumes were traditional partitions on a different storage device entirely. -
13098
I have dual OS (Windows 8 and Ubuntu), when I using Ubuntu, Windows partition Disks are automatically mounted in Explorer. I need to unmount permanently on every boot or permanently. I tried this in Gparted but when reboot it again mounted. Kindly Share your views.
117557
What is the maximum number of times the root filesystem on this computer can be mounted before it is automatically checked?
101845
I have an unusual idea to use git as a backup system. So let's say I have a directory ./backup/myfiles and I want to back that up using git. To keep things clean I don't want to have a .git directory in the myfiles folder, so I thought I could create ./backup/git_repos/myfiles. From looking at the git docs, I've tried doing this:  $ cd backup/myfiles $ mkdir ../git_repos/myfiles $ git --git-dir=../git_repos/myfiles init Initialized empty Git repository in backup/git_repos/myfiles/ $ git --git-dir="../git_repos/myfiles/" add foo fatal: pathspec 'foo' did not match any files   You can see the error message I get there. What am I doing wrong?
57145
I was trying to experiment with docker, Ubuntu 14.04, 64-bit. I managed to run an image, and I gave it the path on one of my removable drives, /media/Drive1.  Now, whenever I reboot, I see there is a /media/Drive1 with only a docker directory inside it, and the actual drive which should be Drive1 ends up mounted on /media/Drive11, and this happens every reboot - even when I unmount these drives, and do a sudo rm -rfv /media/Drive1 before rebooting!  So something probably creates /media/Drive1 before it is fully mounted, and I guess that something is docker, because when I boot, I have:  $ ps axf | grep docker  2085 ?        Ssl    0:00 /usr/bin/docker -d   So, how can I disable the docker autostart, so it doesn't interfere with the mounting of external USB drives at boot?
110860
I previously used to create image files using dd, set up a filesystem on them using mkfsand mount them to access them as mounted partitions. Later on, I have seen on the internet that many examples use losetup beforehand to make a loop device entry under /dev, and then mount it. I could not tell why one would practically need an image file to behave as a loop device and have its own /dev entry while the same behaviour can be obtained without all the hassle.   Summary: In a real-life scenario, why do we need a /dev/loopXentry to be present at all, when we can just mount the fs image without it? What's the use of a loop device?
21036
I've copied the USB drive to an .img file using dd:  dd if=/dev/sdc of=myimage.img   I want to reduce the size of the partition in the image. I've tried several methods and always end up with a loopback-mounted image whose partition is still the full size of the USB.    How do I modify myimage.img to have a smaller partition once loopback-mounted? Do I need to copy zeros into the empty part of the partition before doing so? Do I need to defragment so that when I reduce the image size, I'm deleting empty bytes? (From what I've read, Linux spreads out into the whole partition so I have no expectation that all of the data at the end of the image are zero bytes. Even writing all zeros will just consume the empty bytes wherever they lie.)   NOTE: I'm not trying to save disk space, so zipping doesn't help me.  BACKGROUND  I have Linux installed on a USB drive using ext4. I intend to duplicate the install for multiple devices. I've done so successfully but would like to create on the same USB drive a read-only partition with the system and a small partition that allows persistent storage. Rather than break my USB, I'm trying to modify a copy of the USB. I hope we don't get distracted by this background.  In short, I've done the following:  # Create mount point in current directory sudo mkdir mnt # Loopback mount the image fdisk -l myimage.img sudo mount -o offset=&lt;partion_block_start * block_size&gt; myimage.img mnt # Copy all zeros to remaining space of the image cd mnt sudo dd if=/dev/zero of=filler conv=fsync bs=1M rm filler cd ..   First, I tried to use parted as described in  and qemu-img as described in .  sudo umount mnt parted myimage.img # At parted command prompt (parted) resizepart 1 # Entered my end &lt;target size&gt;. Note that parted uses zero-based  # indexing. This could be your final image size. In my case, the way the # Linux installer worked, the partition started at 1M. (parted) print # I see that the partition is now sized as I expect (parted) exit # Just another sanity check sudo parted -m esp3_007.img unit B print # I see that the partition is now sized as I expect   When I try to mount the image again, it works fine but df still shows the partition as the same size. So then I tried  qemu-img resize myimage.img &lt;target_size&gt;   And now, when I try to mount the image, I get the "mount: wrong fs type, bad option, bad superblock..." error message.  Then I tried using gparted as described in . The GUI showed a full partition unless I ran parted in the first place. Even then, the GUI wouldn't let me resize the partition.  For trying to force the partition size to be smaller, and starting with a fresh copy of myimage.img I tried fdisk described in   sudo fdisk myimage.img Command (m for help): d Command (m for help): n Command action    e   extended    p   primary partition (1-4) p Partition number (1-4, default 1): 1 # defaults on the rest seemed to be correct in my case.   When I mounted the partition, it still showed as the same size.
95901
I installed Ubuntu 14.04 recently. During the installation I did not create a separate partition for my home folder. I also accidentally encrypted my home folder. When i did    sudo df   I got the result as  Filesystem                   Size  Used Avail Use% Mounted on /dev/mapper/ubuntu--vg-root  455G  181G  251G  42% / ....   Why does this have a funny name instead of a normal '/dev/sdx'?  Please explain to me what this is?
43022
I have two NTFS partitions, and I don't want to mount them manually every-time I start Ubuntu.   How can I do this?  Is there a tool or a code to use?   If so, is it safe to automount? specially when they are being used by another OS?