/media directory not working anymore - linux

I can't automount USB sticks on my linux because I have several problems with /media directory.
Here is my ls -al result on / (I just kept the media and mnt directories for you) :
total 116
drwxr-xr-x 25 root root 4096 juin 13 09:39 .
drwxr-xr-x 25 root root 4096 juin 13 09:39 ..
drwx------ 8 acarbonaro acarbonaro 8192 janv. 1 1970 media
drwxr-xr-x 2 root root 4096 avril 11 2014 mnt
This already seems strange as for other users it is often owned by root.
When I try to sudo chown root:root media it says permission denied.
When I try to sudo chown 755 media it doesn't say anything but when I ls -l after nothing has changed.
The other problem : I don't know why but the media directory is empty I can't find the user directory that used to be in it.
When I plug a USB flash drive, it cannot auto mount. I have to mount it manually in another directory, which is not impossible but clearly not handy.
Thank you for your help.
EDIT:
Here is my df -T result :
Sys. de fichiers Type blocs de 1K Utilisé Disponible Uti% Monté sur
udev devtmpfs 4015584 8 4015576 1% /dev
tmpfs tmpfs 805680 1212 804468 1% /run
/dev/sda1 ext4 115214888 9815468 99523708 9% /
none tmpfs 4 0 4 0% /sys/fs/cgroup
none tmpfs 5120 0 5120 0% /run/lock
none tmpfs 4028392 522580 3505812 13% /run/shm
none tmpfs 102400 600 101800 1% /run/user
/dev/sda2 ext4 130654772 18532260 105462572 15% /home
/dev/sdb2 vfat 14938864 218480 14720384 2% /media
EDIT:
I don't know the answer to my problem, but rebooting reset the /media directory as it was before and it works agian.

I assume the problem was that you have yanked the USB stick out of port without unmounting. UNIX is not very keen to parts of its FS disappearing. Next time, umount it first, then remove.

Related

Can I mount a S3 bucket mounted to Linux EC2 to a Windows EC2 with Samba(smb)?

I have a situation where in I have to mount AWS S3 bucket to a Linux EC2 instance(Linux) using FUSE(S3FS).
Once the Bucket it mounted, it need to be mounted in an Windows EC2 instance with Samba(smb).
I am able to mount the S3 bucket to the Linux EC2 instance using FUSE (S3FS),
but while trying to change content for Samba mount I get the below error:
[centos#sharedfs-23-117 /]$ sudo chcon -t samba_share_t /s3fs-ed/
chcon: failed to change context of ‘/s3fs-ed/’ to ‘system_u:object_r:samba_share_t:s0’: Operation not supported.
Note: My S3 bucket is mounted on /s3fs-ed.
Observation: df -h List all the mounts including the S3 mount:
[centos#sharedfs-23-117 /]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 472M 0 472M 0% /dev
tmpfs 493M 240K 493M 1% /dev/shm
tmpfs 493M 13M 480M 3% /run
tmpfs 493M 0 493M 0% /sys/fs/cgroup
/dev/xvda1 8.0G 1.1G 7.0G 13% /
/dev/xvdb1 8.0G 574M 7.5G 8% /store
tmpfs 99M 0 99M 0% /run/user/1000
s3fs 256T 0 256T 0% /s3fs-ed
But When I try to list the disk by UUID, I do not see the S3 mount being listed:
[centos#sharedfs-23-117 /]$ ls -lha /dev/disk/by-uuid
total 0
drwxr-xr-x. 2 root root 80 Jul 16 09:07 .
drwxr-xr-x. 5 root root 100 Jul 16 09:07 ..
lrwxrwxrwx. 1 root root 11 Jul 16 09:07 388a99ed-9486-4a46-aeb6-06eaf6c47675 -> ../../xvda1
lrwxrwxrwx. 1 root root 11 Jul 16 09:07 fce0d14e-24c6-4f69-b04b-b80041cd636f -> ../../xvdb1
I need help to mount the S3 mount using Samba to the Windows EC2 instance.
Note : Due to some limitation I cannot mount S3 to Windows with rclone (https://rclone.org/).
I have tried disabling the SELinux also , Still the same error
[centos#sharedfs-23-117 /]$ sestatus
SELinux status: disabled
I mount a bucket with s3fs with the following command:
s3fs bucketname /mnt/s3/ -o passwd_file=/etc/.passwd-s3fs -o umask=0000 -o allow_other -o kernel_cache
And I share the folder /mnt/s3 with samba with no problems.
I you still have trouble, share your s3fs mount command, and the smb.conf section you use to share the mount point.

Used size in root directory is higher than the actual consumption

used size of root directory is 13G as per the df -kh. but when i checked the individual size of the files and folder of root, the size is around 3G. where is the remaining files/folders located in root directory.
Below some outputs for reference,
[root#adair01 opt]# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root 66G 13G 51G 20% /
[root#adair01 var]# du -sch /*
0 /bin
225M /boot
0 /dev
41M /etc
148K /export
156K /home
0 /lib
0 /lib64
16K /lost+found
4.0K /media
0 /misc
4.0K /mnt
0 /net
1.5G /opt
du: cannot access ‘/proc/30925/task/30925/fd/4’: No such file or directory
du: cannot access ‘/proc/30925/task/30925/fdinfo/4’: No such file or directory
du: cannot access ‘/proc/30925/fd/4’: No such file or directory
du: cannot access ‘/proc/30925/fdinfo/4’: No such file or directory
0 /proc
228K /root
42M /run
0 /sbin
4.0K /srv
0 /sys
1.1M /tmp
1.2G /usr

/dev/vda1 is full but cannot find why

I have a server running Centos 7. This is the result of df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.4G 0 7.4G 0% /dev
tmpfs 1.5G 139M 1.4G 10% /run
/dev/vda1 46G 44G 0 100% /
tmpfs 7.4G 0 7.4G 0% /dev/shm
tmpfs 7.4G 0 7.4G 0% /sys/fs/cgroup
/dev/vda15 99M 3.6M 95M 4% /boot/efi
/dev/mapper/LVMVolGroup-DATA_VOLUME 138G 17G 114G 13% /mnt/data
tmpfs 1.5G 0 1.5G 0% /run/user/0
Even if there are 2GB of free space on / , it shows that the filesystem is at 100% of usage, and I can't install new packages because it tells me there's no space left on device.
Besides, if I type sudo du -sh /* | sort -rh | head -15
the result is:
17G /mnt
1.1G /usr
292M /var
208M /root
139M /run
49M /boot
48M /tmp
32M /etc
28K /home
16K /lost+found
12K /anaconda-post.log
4.0K /srv
4.0K /opt
4.0K /media
0 /sys
So it seems that there are no big files filling up the disk, and the sum of the sizes of the directories is not even equal to 44GB.
Additional info: the only service running on the server is Jenkins, but its home is under /mnt/data/jenkins.
How can I solve the problem?
Found the solution.
The problem was related to some deleted files kept open by Jenkins.
Restarting the service the problem was solved.
The problem was related to the system cache/temp storage. Linux system created the cache files and its archive from time to time, especially when some long option is run like DB import or crone job etc.. or sometimes server up from sines long.
Restarting the service or server
so due to that, the cache/ temp files were deleted and the problem was solved.
even in windows, we faced that kind of performance issue when RAM is low, and restarting the system is the primary solution for that.

/dev/mapper/fedora-root full to 96%, but more than 50% of the weight seems to be hidden

The facts:
# ls -lh /
total 80K
drwxrwxrwx. 5 root root 4.0K May 26 2015 backUp
lrwxrwxrwx. 1 root root 7 Aug 16 2014 bin -> usr/bin
dr-xr-xr-x. 4 root root 3.0K Jan 5 14:13 boot
drwxrwxrwx. 6 root root 4.0K Jul 16 12:01 data_1
drwxrwxrwx. 5 root root 4.0K Jun 10 2015 data_2
drwxr-xr-x. 20 root root 3.6K Jan 6 09:29 dev
drwxr-xr-x. 160 root root 12K Jan 6 10:28 etc
drwxr-xr-x. 4 root root 4.0K Aug 16 2014 home
drwxr-xr-x. 2 root root 0 Jan 6 09:56 hosts
lrwxrwxrwx. 1 root root 7 Aug 16 2014 lib -> usr/lib
lrwxrwxrwx. 1 root root 9 Aug 16 2014 lib64 -> usr/lib64
drwx------. 2 root root 16K Nov 4 2014 lost+found
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 media
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 mnt
drwxr-xr-x. 4 root root 4.0K Jul 17 17:43 opt
dr-xr-xr-x. 295 root root 0 Jan 6 10:29 proc
dr-xr-x---. 25 root root 4.0K Jan 6 10:51 root
drwxr-xr-x. 46 root root 1.4K Jan 6 10:46 run
lrwxrwxrwx. 1 root root 8 Aug 16 2014 sbin -> usr/sbin
drwxr-xr-x. 2 root root 4.0K Aug 16 2014 srv
dr-xr-xr-x. 13 root root 0 Jan 6 09:29 sys
drwxr-xr-x. 2 root root 4.0K Jul 15 16:25 sysroot
drwxrwxrwt. 14 root root 300 Jan 6 10:56 tmp
drwxr-xr-x. 14 root root 4.0K Sep 14 16:57 usr
drwxr-xr-x. 20 root root 4.0K Jan 6 10:29 var
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 32G 0 32G 0% /dev
tmpfs 32G 308K 32G 1% /dev/shm
tmpfs 32G 1.5M 32G 1% /run
tmpfs 32G 0 32G 0% /sys/fs/cgroup
/dev/mapper/fedora-root 50G 45G 2.3G 96% /
tmpfs 32G 328K 32G 1% /tmp
/dev/sda3 477M 147M 301M 33% /boot
/dev/sdb2 917G 288G 583G 34% /data_2
/dev/sdb1 917G 20G 852G 3% /data_1
/dev/mapper/fedora-home 160G 13G 140G 9% /home
/dev/sdc1 2.7T 383G 2.2T 15% /backUp
tmpfs 6.3G 8.0K 6.3G 1% /run/user/42
tmpfs 6.3G 36K 6.3G 1% /run/user/1385
# pvdisplay
--- Physical volume ---
PV Name /dev/sda5
VG Name fedora
PV Size 235.95 GiB / not usable 0
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 60402
Free PE 0
Allocated PE 60402
PV UUID 8oXP7e-NSTf-weml-tWWg-E64b-mjmq-nzcf19
# lvdisplay
--- Logical volume ---
LV Path /dev/fedora/swap
LV Name swap
VG Name fedora
LV UUID Ego2By-VwgS-bIic-Wwna-D5u8-4JDi-9gVAez
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2014-11-04 12:35:40 +0100
LV Status available
# open 2
LV Size 23.85 GiB
Current LE 6105
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0
--- Logical volume ---
LV Path /dev/fedora/home
LV Name home
VG Name fedora
LV UUID uPHuWm-rdMX-AOt9-MJWP-5Qgs-a83u-Asqktc
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2014-11-04 12:35:40 +0100
LV Status available
# open 1
LV Size 162.10 GiB
Current LE 41497
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:2
--- Logical volume ---
LV Path /dev/fedora/root
LV Name root
VG Name fedora
LV UUID PQG3IH-2lt3-PCyq-c6by-fSxL-2a2L-Hlr87V
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2014-11-04 12:35:46 +0100
LV Status available
# open 1
LV Size 50.00 GiB
Current LE 12800
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1
# du -sh /*
382G /backUp
0 /bin
145M /boot
20G /data_1
288G /data_2
308K /dev
42M /etc
12G /home
0 /hosts
0 /lib
0 /lib64
16K /lost+found
4.0K /media
4.0K /mnt
137M /opt
du: cannot access ‘/proc/13761/task/13761/fd/3’: No such file or directory
du: cannot access ‘/proc/13761/task/13761/fdinfo/3’: No such file or directory
du: cannot access ‘/proc/13761/fd/3’: No such file or directory
du: cannot access ‘/proc/13761/fdinfo/3’: No such file or directory
0 /proc
35M /root
du: cannot access ‘/run/user/1385/gvfs’: Permission denied
du: cannot access ‘/run/user/42/gvfs’: Permission denied
1.5M /run
0 /sbin
4.0K /srv
0 /sys
4.0K /sysroot
4.0K /tmp
9.3G /usr
2.9G /var
So, according to these results, /backUp, /data_1 and /data_2 are mounted on two disks (/dev/sdc and /dev/sdb respectively) and the system in an other disk (/dev/sda) with LVM.
the df -h command returns that the / is full to 96%:
/dev/mapper/fedora-root 50G 45G 2.3G 96% /
But if we take the return of the du -sh for the /, we observe that the more heavy directories are the /usr et /var, with a total weight of roughly 13G (/backUp, /data_1 and /data_2 are on other disks and /home correspond to /dev/mapper/fedora-home):
9.3G /usr
2.9G /var
Thus, it appears that the / from the du command is weighting nearly 13G and from df command nearly 45G ... So I have 32G in a black hole ...
I do not see the error, please do not hesitate to give advice to fix this very strange things !I am sure that I miss something ...
I lost a lot of time for finally a very easy thing.
As proposed in comment by mattdm, in this case the more easy and quick thing to try is to unmount all the volumes (except the system, of course) and check if data exist again in the mount point. The problem can comes in the case of an automatic backup each day (as I do). If for an unknown reason the corresponding disk is unpluged (or other) the backup will be done on the root file (the mounting point). If the disk is then mounted (again for an unknow reason - the date for this problem corresponds to christmas vacation :-)) , the corresponding data on the root file will be obscured !!!!
For the long version see here.
Hope this will help.
I also had the same question. Because the system log is so large, you must clean this by manually.
One way:
cd /var/log
rm 'the large file'

ec2 - Do temporary files fill up root ebs volume if there is no ephemeral instance store?

Related to: How do I add instance storage to an existing Windows EC2 instance?
My root 60G ebs volume fill up very quickly, and I can't find the culprit in the file system. My actual files only take up about 10G. I've found out that if I "Stop" and then "Start" the instance, it frees up the remaining 50G.
Note: I started the instance as free micro and then later upgraded to m3.medium. Apparantly micro instances don't have ephemeral storage and you can only add "instance store" upon launching an instance. So I'm thinking I don't have access to ephemeral storage and that it is instead eating up my root ebs volume space with temporary files. Is that possible?
#df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 59G 47G 13G 80% /
devtmpfs 1.9G 12K 1.9G 1% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
#du -sh /* | sort -n
0 /proc
0 /sys
4.0K /local
4.0K /media
4.0K /mnt
4.0K /selinux
4.0K /srv
7.3M /etc
8.0K /tmp
8.1M /bin
8.6G /var
9.7M /sbin
12K /dev
16K /lost+found
17M /root
21M /lib64
24K /run
26M /home
49M /boot
59M /opt
122M /lib
858M /usr
The problem had nothing to do with ephemeral storage. It was that httpd wasn't restarting after logrotate.

Resources