Can I assign a device node to the mount point in /etc/fstab [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
Host: Ubuntu 14.10
I have one line in my /etc/fstab file shown in the following:
UUID=00e12ac3-210d-53te-91ca-82a11226d5c8 /media/laptop/SSD/ ext4 errors=remount-ro 0 1
This SSD has its device node which is /dev/sda.
Is it possible to change it from /dev/sda to /dev/sdb in /etc/fstab file ?
If so, how can I modify it ?

The kernel assigns the device number when it detects the device. So when the first device that looks like a 'scsi disk' (sd) is detected, it is assigned the device-number (8, 0) and is thus /dev/sda. When the second is detected, it is (8, 16) and so on.
# ls -l /dev/sd[ab]
brw-rw----. 1 root disk 8, 0 Dec 6 2014 /dev/sda
brw-rw----. 1 root disk 8, 16 Dec 6 2014 /dev/sdb
You could, at your own risk!, swap the /dev/sda[ab]* entries, so they looked something like this:
# ls -l /dev/sd[ab]
brw-rw----. 1 root disk 8, 16 Jan 19 2016 /dev/sda
brw-rw----. 1 root disk 8, 8 Jan 19 2016 /dev/sdb
but I don't recommend that kind of hanky-panky unless you really know what you are doing and what all the possible ramifications are.
Instructions:
(su / sudo / login as root)
# cd /dev
# ls -l sd[ab]*
Note the device numbers, they may be different from mine!
Remove existing
# rm sd[ab]*
Make again with swapped minor device numbers
# mknod sda b 8 16
# mknod sda1 b 8 17
# mknod sdb b 8 0
# mknod sdb1 b 8 1
(you may need to alter your boot config, grub or whatever)
# reboot
Again, I stress this is at your own risk, I have no idea what on your system this could effect.

Related

Trouble running statrup script on Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I'm using the Amazon flavor of Linux
uname -a
Linux mydomain.org 3.19.25-82.99.amzn1.x86_64 #1 SMP Wed Dec 3 21:29:43 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
and I want to run the following script upon system reboot ...
ls -al /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh
-rwxr-xr-x 1 davea mycompany 2023 Nov 28 2011 /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh
So I created this file,
-rwxr-xr-x 1 root root 73 Dec 10 19:29 /etc/init.d/start_tomcat
with the lines
#!/bin/sh
sh /home/davea/install/apache-tomcat-6.0.35/bin/startup.sh
However, when I reboot my system, this script isn't getting invoked. What steps have I left out? I can run the script fine at a command line when I'm logged in.
Edit: Also, I created this symlink in /etc/rc.d ...
ls -al /etc/rc.d/start_tomcat
lrwxrwxrwx 1 root root 24 Dec 10 19:29 /etc/rc.d/start_tomcat -> /etc/init.d/start_tomcat
Still no luck.
You have to add the start-up script under init.d to your default runlevel.
sudo update-rc.d /etc/init.d/start_tomcat defaults
Which should create symlinks to your script under the appropriate /etc/rc?.d folder(s).
This depends on which startup program is being used. Assuming you have privileges to do so, and if the star up program is the chkconfig program your etc/init.d/start script must follow suit in that you need such header fields like:
# chkconfig: <levels> <start> <stop>
# description: <some description>
For other programs, like systemctl (redhat/fedora) you'll need to create a file with directives in it in the following folder:
/etc/systemd/system/
You'd typically make a file called serviceName.service with the following entries:
[Unit]
Description=MyApp
[Service]
ExecStart=/path/to/myService/executable.sh
[Install]
WantedBy=multi-user.target
Then run:
sudo systemctl enable /etc/systemd/system/hello.service
sudo systemctl start hello.service
If this is a LSB (Linux Standards Based) OS/Startup you should follow the tutorial below:
https://wiki.debian.org/LSBInitScripts

Cannot write to mounted (external) HDD [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have tried mounting my external (usb) HDD, but eventhough the permissions match (between the user and the mounted disk) I cannot write, even as root. I tried mounting using pmount and "normal" mount.
System info:
Linux b2 2.6.39.4-4 #1 Fri Aug 19 14:41:59 CEST 2011 ppc GNU/Linux
User info:
zero#b2:~$ id -a
uid=1001(zero) gid=100(users) groups=100(users),46(plugdev)
pmount test:
zero#b2:~$ pmount /dev/sdb1 HDD
zero#b2:~$ mount
...
/dev/sdb1 on /media/HDD type ntfs (rw,noexec,nosuid,nodev,uid=1001,gid=100,umask=077,nls=utf8)
zero#b2:~$ stat /media/HDD/
File: `/media/HDD/'
Size: 4096 Blocks: 8 IO Block: 512 directory
Device: 811h/2065d Inode: 5 Links: 1
Access: (0700/drwx------) Uid: ( 1001/ zero) Gid: ( 100/ users)
zero#b2:~$ touch /media/HDD/testtouch
touch: cannot touch `/media/HDD/testtouch': Permission denied
I also cannot add any new directories.
Interestingly enough I CAN edit and save existing files (but not copy etc.)
test writing to existing file:
root#b2:/home/zero# mount -t ntfs /dev/sdb1 -o umask=022,gid=100,uid=1001 TEST/
root#b2:/home/zero# mount -l
...
/dev/sdb1 on /home/zero/TEST type ntfs (rw,umask=022,gid=100,uid=1001)
zero#b2:~$ cat TEST/test
zero#b2:~$ echo "writing text" > TEST/test
zero#b2:~$ cat TEST/test
writing text
Any ideas?
Read/write access to NTFS filesystems in the Linux kernel. Use ntfs-3g (FUSE) if you need read/write access.
sudo apt-get install ntfs-3g
sudo mount -t ntfs-3g /dev/sdb1 /media/HDD
sudo touch /media/HDD/I_can_write,_my_friends
NTFS-3G homepage:
http://www.tuxera.com/community/ntfs-3g-download/
More or support of NTFS in Debian:
https://wiki.debian.org/NTFS

Reserved Process ID [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
As per my knowledge Process ID 1 is reserved for init.
What does process id 2 indicate? why no softlink to the binary executable for this process ID.
sudo ls -l /proc/1/exe
lrwxrwxrwx 1 root root 0 Apr 24 14:53 /proc/1/exe --> /sbin/init
But for /proc/2/exe
ls : cannot read symbolic link /proc/2/exe: No such file or directory
lrwxrwxrwx 1 root root 0 Apr 24 14:53 /proc/2/exe
Im using Ubuntu 12.04.
pls share your knowledge.
It's because there is no binary to link to. This process was probably started by the kernel itself. Take a look at the out put of ps aux. Any process you see listed in brackets will not have a exe soft link either.
because at the moment you are asking there is no process of pid 2.
the kernel allocates pids at will.
Or because pid 2 is for some kernel task; on my machine it is for kthreadd which is some pure kernel process. See this answer.

create a virtual floppy image without mount? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
There are a lot of posts to show to create a virtual floppy image file as a super user or users can run sudo command. The basic steps are:
create empty 1.44MB image file by dd command
format the image file by mkfs.msdos
mount the image file to some mount point
copy something to the mount point
umount the virtual floppy image file
my question is, in case I am just a common user who cannot run sudo command, how can I follow above steps to create a virtual floppy image and write something in it?
Thanks a lot.
Yes, of course you can do this. Use mtools for the FAT and e2tools or genext2fs for the ext2 filesystems.
$ dd if=/dev/zero of=/tmp/disk1.img count=1440 bs=1k
1440+0 records in
1440+0 records out
1474560 bytes (1.5 MB) copied, 0.00569719 s, 259 MB/s
$ /sbin/mkfs.msdos /tmp/disk1.img
mkfs.msdos 3.0.12 (29 Oct 2011)
$ mdir -i /tmp/disk1.img
Volume in drive : has no label
Volume Serial Number is 9913-BFF6
Directory for ::/
No files
1 457 664 bytes free
$ mcopy -i /tmp/disk1.img /etc/issue.net ::/
$ mdir -i /tmp/disk1.img
Volume in drive : has no label
Volume Serial Number is 9913-BFF6
Directory for ::/
issue net 28 2012-06-26 10:49
1 file 28 bytes
1 457 152 bytes free
And of course, I have no root rights.

What is equivalent of Linux's 'free' command on FreeBSD v8.1 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
What is equivalent of Linux's 'free' command on FreeBSD v8.1?
I am calling 'free' from my application and reporting the results in my application's log file. What would be the replacement when porting to FreeBSD v8.1?
Here is a sample run of 'free' on Linux:
[centos4x32 ~] free
total used free shared buffers cached
Mem: 774452 733044 41408 0 98040 328880
-/+ buffers/cache: 306124 468328
Swap: 2031608 224 2031384
vmstat has default output which is similar in nature and takes many options that give extremely detailed information, eg vmstat -m
swapinfo would cover the swap part
top -d1 causes top to print one screen and exit, and the banner is very similar to free. Use top -d1 | head -n 7 to see only the banner
Maybe freecolor command is a choice. Install it:
# cd /usr/ports/sysutils/freecolor
# make install clean
Use it:
# freecolor
Physical : [#################################..] 94% (1907820/2018396)
Swap : [###################################] 100% (1048540/1048540)
# freecolor -m -o
total used free shared buffers cached
Mem: 1971 107 1863 0 0 0
Swap: 1023 0 1023
Please refer FreeBSD find out RAM size Including Total Amount of Free and Used Memory Size.
vmstat -s gives some more human-readable or script-parseable information, including listing the page size. Otherwise, it gives output in numbef of pages. With no options, vmstat gives a brief summary.
The vmstat command also exists on NetBSD.
just use old good htop
install htop
pkg install htop
to run
htop
Other option:
# vmstat fre
procs memory page faults cpu
r b w avm fre flt re pi po fr sr in sy cs us sy id
0 0 0 13475M 24M 689 1 2 0 344 394 14693 37734 60809 7 43 50
You can use this script.
# fetch http://www.cyberciti.biz/files/scripts/freebsd-memory.pl.txt
# mv freebsd-memory.pl.txt /usr/local/bin/free
# chmod +x /usr/local/bin/free
source: http://www.cyberciti.biz/faq/freebsd-command-to-get-ram-information/

Resources