Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
04-02-2017, 01:26 PM
|
#1
|
Member
Registered: Apr 2015
Posts: 217
Rep: 
|
Define partition and mount point
Hi there,
My system is like following:
Code:
[zillur@localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl-root 50G 4.2G 46G 9% /
devtmpfs 87G 0 87G 0% /dev
tmpfs 87G 84K 87G 1% /dev/shm
tmpfs 87G 9.7M 87G 1% /run
tmpfs 87G 0 87G 0% /sys/fs/cgroup
/dev/sdb1 1014M 140M 875M 14% /boot
/dev/mapper/cl-home 26T 66M 26T 1% /home
tmpfs 18G 48K 18G 1% /run/user/1000
[zillur@localhost ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 14.6T 0 disk
└─sda1 8:1 0 14.6T 0 part
└─cl-home 253:2 0 25.5T 0 lvm /home
sdb 8:16 0 111.8G 0 disk
├─sdb1 8:17 0 1G 0 part /boot
└─sdb2 8:18 0 110.8G 0 part
├─cl-root 253:0 0 50G 0 lvm /
└─cl-home 253:2 0 25.5T 0 lvm /home
sdc 8:32 0 10.9T 0 disk
└─sdc1 8:33 0 10.9T 0 part
├─cl-swap 253:1 0 4G 0 lvm [SWAP]
└─cl-home 253:2 0 25.5T 0 lvm /home
sr0 11:0 1 1024M 0 rom
sr1 11:1 1 1024M 0 rom
[zillur@localhost ~]$ pvs
WARNING: Running as a non-root user. Functionality may be unavailable.
/run/lvm/lvmetad.socket: access failed: Permission denied
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
/run/lock/lvm/P_global:aux: open failed: Permission denied
Unable to obtain global lock.
[zillur@localhost ~]$ sudo pvs
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
[sudo] password for zillur:
PV VG Fmt Attr PSize PFree
/dev/sda1 cl lvm2 a-- 14.55t 0
/dev/sdb2 cl lvm2 a-- 110.79g 0
/dev/sdc1 cl lvm2 a-- 10.92t 0
[zillur@localhost ~]$ vgs
WARNING: Running as a non-root user. Functionality may be unavailable.
/run/lvm/lvmetad.socket: access failed: Permission denied
WARNING: Failed to connect to lvmetad. Falling back to device scanning.
/dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.135-RHEL7 (2016-09-28) and kernel driver (unknown version).
[zillur@localhost ~]$ sudo vgs
VG #PV #LV #SN Attr VSize VFree
cl 3 3 0 wz--n- 25.58t 0
I want to create a mount point like:
then I want to allocate 10 TB to my /backup
and rest of the disk space may remain in /home
Is it possible??
Best Regards
zillur
|
|
|
04-02-2017, 02:23 PM
|
#2
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
|
|
1 members found this post helpful.
|
04-02-2017, 02:41 PM
|
#3
|
Senior Member
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,828
|
You can do it, but since there is no unallocated space you will have to shrink the cl/home LV and filesystem to make space. Note that keeping a backup on the same disk does not give any protection against disk failure or damage to the partitioning or LVM structure. I presume you have some other goal for that backup.
You cannot shrink a filesystem while it is mounted, and an XFS filesystem cannot be shrunk at all. For non-XFS filesystems, you will need to boot single user, unmount /home, and then resize the LV and filesystem. (All of the following commands need to be run as root.)
Code:
umount /home
lvreduce --resizefs --size -10T cl/home
Now you can create a new LV and filesystem.
Code:
lvcreate --extents 100%FREE -n backup cl
mkfs.{whatever} /dev/mapper/cl-backup
Then you just need to create the /backup mount point directory and put an entry in /etc/fstab if you want it mounted automatically.
|
|
1 members found this post helpful.
|
04-06-2017, 07:19 AM
|
#4
|
Member
Registered: Apr 2015
Posts: 217
Original Poster
Rep: 
|
Thank you very much for helping me all the way. My current system is like following:
Code:
[zillur@localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl00-root 50G 4.0G 46G 8% /
devtmpfs 87G 0 87G 0% /dev
tmpfs 87G 116K 87G 1% /dev/shm
tmpfs 87G 66M 87G 1% /run
tmpfs 87G 0 87G 0% /sys/fs/cgroup
/dev/sdb2 1014M 205M 810M 21% /boot
/dev/mapper/cl00-home 56G 107M 56G 1% /home
tmpfs 18G 36K 18G 1% /run/user/1000
/dev/sda1 15T 19M 14T 1% /gondor
/dev/sdg1 11T 61M 11T 1% /mordor
and:
Code:
[zillur@localhost ~]$ sudo pvscan
PV /dev/sdb3 VG cl00 lvm2 [109.79 GiB / 0 free]
Total: 1 [109.79 GiB] / in use: 1 [109.79 GiB] / in no VG: 0 [0 ]
[zillur@localhost ~]$ sudo lvscan
ACTIVE '/dev/cl00/swap' [4.00 GiB] inherit
ACTIVE '/dev/cl00/home' [55.79 GiB] inherit
ACTIVE '/dev/cl00/root' [50.00 GiB] inherit
[zillur@localhost ~]$ sudo vgscan
Reading volume groups from cache.
Found volume group "cl00" using metadata type lvm2
Do you guys think its a good idea? I don't have any volume group or logical volume for /dev/sda1 and /dev/sdg1. Can I run a system like this where users will login and then work in /gondor and /mordor ?? Need your suggestions.
Best Regards
Zillur
|
|
|
04-06-2017, 07:26 AM
|
#5
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
Quote:
Originally Posted by zillur
Thank you very much for helping me all the way. My current system is like following:
Code:
[zillur@localhost ~]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/cl00-root 50G 4.0G 46G 8% /
devtmpfs 87G 0 87G 0% /dev
tmpfs 87G 116K 87G 1% /dev/shm
tmpfs 87G 66M 87G 1% /run
tmpfs 87G 0 87G 0% /sys/fs/cgroup
/dev/sdb2 1014M 205M 810M 21% /boot
/dev/mapper/cl00-home 56G 107M 56G 1% /home
tmpfs 18G 36K 18G 1% /run/user/1000
/dev/sda1 15T 19M 14T 1% /gondor
/dev/sdg1 11T 61M 11T 1% /mordor
and:
Code:
[zillur@localhost ~]$ sudo pvscan
PV /dev/sdb3 VG cl00 lvm2 [109.79 GiB / 0 free]
Total: 1 [109.79 GiB] / in use: 1 [109.79 GiB] / in no VG: 0 [0 ]
[zillur@localhost ~]$ sudo lvscan
ACTIVE '/dev/cl00/swap' [4.00 GiB] inherit
ACTIVE '/dev/cl00/home' [55.79 GiB] inherit
ACTIVE '/dev/cl00/root' [50.00 GiB] inherit
[zillur@localhost ~]$ sudo vgscan
Reading volume groups from cache.
Found volume group "cl00" using metadata type lvm2
Do you guys think its a good idea? I don't have any volume group or logical volume for /dev/sda1 and /dev/sdg1. Can I run a system like this where users will login and then work in /gondor and /mordor ?? Need your suggestions.
Best Regards
Zillur
|
I do not know much of anything about LVM but I do suppose it cannot be much different when it comes to setting it up to be used in Linux via the fstab and mount methodology.
where mount and bind commands are put to use. therefore if you want someone to log in and work or have their home directory be on a different volume. I do not see why one could not just used mount then bind to set that particular person in a different volume then the others are in whenever they log in. While it will look like he is on the same volume it is not so. Due to binding his /home/user to a different volume /directory to his entire /home/user area.
http://backdrift.org/how-to-use-bind-mounts-in-linux
Last edited by BW-userx; 04-06-2017 at 07:29 AM.
|
|
1 members found this post helpful.
|
04-06-2017, 07:37 AM
|
#6
|
Member
Registered: Apr 2015
Posts: 217
Original Poster
Rep: 
|
Thank you very much for a quick reply. I also don't know anything on partitioning or LVM. In my current system, I want users will login normally and cd to /gondor or /mordor to use /dev/sdg1 or /dev/sda1. Is it possible without changing anything? Do you think "chown user /mordor" will be sufficient?
Best Regards
Zillur
|
|
|
04-06-2017, 08:07 AM
|
#7
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
Quote:
Originally Posted by zillur
Thank you very much for a quick reply. I also don't know anything on partitioning or LVM. In my current system, I want users will login normally and cd to /gondor or /mordor to use /dev/sdg1 or /dev/sda1. Is it possible without changing anything? Do you think "chown user /mordor" will be sufficient?
Best Regards
Zillur
|
where /gondor or /mordor I take it are just directories where you want others to work in. then all they have to do is cd into it. and yes just change its permissions.
you can keep control of it while giving certain permissions to others as well to either read, or read write, or read, write and execute within any directory.
Your line of thought is correct in thinking that chown will work. Their is also many other ways to get this done.
Keeping in mind this is a root user permissions that can only do this with others stuff. and a user permissions that can do this with one own "stuff".
Code:
chmod u=rwx,g=rx,o=r /DirectoryName
chmod u=rwx,g=rx,o=r file
as you see it can be broken into parts to set permission onto an item in any fashion one wants as long as it stays within the limits given that allows this to be done.
Code:
chown user:group /directory
chown root:users /mordor
chmod u=rwx g=r o-rwx /mordor
You can still allow root to own the directory so no one else can delete it. then do this in any fastion you wish.
User gets read, write, and execute, Group gets read only, Other gets nothing, the minus '-' removes permissions. the equal '=' adds permissions.
Making sure that the users that you want to use that directory are assigned to the group.
Code:
usermod -aG users UserName
u = User (owner)
g = Group
o = Others or anyone else that can get inside of a directory, but when the other has all permissions removed then what takes place?
https://www.linode.com/docs/tools-re...ons-with-chmod
Last edited by BW-userx; 04-06-2017 at 08:11 AM.
|
|
1 members found this post helpful.
|
04-06-2017, 08:13 AM
|
#8
|
Member
Registered: Apr 2015
Posts: 217
Original Poster
Rep: 
|
Thank you very much.
|
|
|
04-06-2017, 08:28 AM
|
#9
|
LQ Guru
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342
|
you're very welcome
Last edited by BW-userx; 04-06-2017 at 08:29 AM.
|
|
|
All times are GMT -5. The time now is 12:27 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|