Skip to main content
Try delete useless code to shorten this question.
Source Link
illiterate
  • 993
  • 7
  • 23

my initramfs init:

...too long text...
mountroot
mount --bind "${rootmnt}${ROOTDIR}" "${rootmnt}"
log_end_msg

if read_fstab_entry /usr; then
    log_begin_msg "Mounting /usr file system"
    mountfs /usr
    log_end_msg
fi

# Mount cleanup
mount_bottom
nfs_bottom
local_bottom

maybe_break my_init
test -f "${rootmnt}/my_init" && . "${rootmnt}/my_init"
...too long text...

the "my_init":

mount /dev/sda2 ${rootmnt}/home
mount --bind ${rootmnt}/home/home ${rootmnt}/home/
#panic "test"
#dd if=/dev/urandom of=/New bs=1M count=1024
echo 2 | tee /sys/block/*/queue/rq_affinity

my /etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
#UUID=0a018953-88e9-43e9-b1aa-aca60f7756b2 /               ext4    errors=remount-ro 0       1

#/dev/sda2 /               ext4    defaults 0       0


#/dev/sda4        none   vfat,iso9660 user,noauto     0       0

#/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

/dev/sr0        /media/cdrom0 auto user,noauto

my initramfs init:

...too long text...
mountroot
mount --bind "${rootmnt}${ROOTDIR}" "${rootmnt}"
log_end_msg

if read_fstab_entry /usr; then
    log_begin_msg "Mounting /usr file system"
    mountfs /usr
    log_end_msg
fi

# Mount cleanup
mount_bottom
nfs_bottom
local_bottom

maybe_break my_init
test -f "${rootmnt}/my_init" && . "${rootmnt}/my_init"
...too long text...

the "my_init":

mount /dev/sda2 ${rootmnt}/home
mount --bind ${rootmnt}/home/home ${rootmnt}/home/
#panic "test"
#dd if=/dev/urandom of=/New bs=1M count=1024
echo 2 | tee /sys/block/*/queue/rq_affinity

my /etc/fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda2 during installation
#UUID=0a018953-88e9-43e9-b1aa-aca60f7756b2 /               ext4    errors=remount-ro 0       1

#/dev/sda2 /               ext4    defaults 0       0


#/dev/sda4        none   vfat,iso9660 user,noauto     0       0

#/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

/dev/sr0        /media/cdrom0 auto user,noauto
edited tags
Source Link
terdon
  • 244.6k
  • 67
  • 464
  • 696

Why I can I (or cannot) again mount a mounted device again? whatWhat is happenedhappening?

Why I can I (or cannot) again mount a mounted device again? whatWhat is happenedhappening?
For example:

Why I can (or cannot) again mount a mounted device? what is happened?

Why I can (or cannot) again mount a mounted device? what is happened?
For example:

Why can I (or cannot) mount a mounted device again? What is happening?

Why can I (or cannot) mount a mounted device again? What is happening?
For example:

Replace example code with a clearer code
Source Link
illiterate
  • 993
  • 7
  • 23

Why I can (or cannot) again mount a mounted device? what is happened?

Why I can (or cannot) again mount a mounted device? what is happened?
For example:

/tmp/test$ sudo mount /dev/sda5 ./1;echo ${?}
0
/tmp/test$ sudo mount |grep/dev/sda5 sda2./2;echo ${?}
0
/tmp/test$ sudo mount | grep test
/dev/sda2sda5 on /hometmp/test/1 type ext4 (rw,relatime,data=ordered)
/dev/sda2sda5 on /hometmp/test/2 type ext4 (rw,relatime,data=ordered)
$/tmp/test$ sudo mountumount /dev./sda21 ./mnt
$ echo2;echo ${?}
0
$/tmp/test$ sudo mountlosetup
NAME |grep sda2     SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE          DIO
/dev/sda2loop0 on        0      0         0  0 /hometmp/test/grub.iso type ext4 (rw,relatime,data=ordered)0
/devtmp/sda2test$ onsudo mount /homedev/loop0 type./1;echo ext4${?}
mount: (rw,relatime/dev/loop0 is write-protected,data=ordered) mounting read-only
0
/tmp/test$ sudo mount /dev/sda2loop0 on./2;echo ${?}
mount: /mntdev/loop0 typeis ext4already (rw,relatime,data=ordered)
$mounted unameor -a/tmp/test/2 busy
Linux debian 4.14.13 #1 SMP Tue Mar 27/dev/loop0 04:52:30is CSTalready 2018mounted i686on GNU/Linuxtmp/test/1
$32
/tmp/test$ sudo mount | grep test
/dev/loop0 on /tmp/test/1 type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048)
/tmp/test$ 

Why I can again mount a mounted device? what is happened?

Why I can again mount a mounted device? what is happened?

$ sudo mount |grep sda2
/dev/sda2 on /home type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /home type ext4 (rw,relatime,data=ordered)
$ sudo mount /dev/sda2 /mnt
$ echo $?
0
$ sudo mount |grep sda2
/dev/sda2 on /home type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /home type ext4 (rw,relatime,data=ordered)
/dev/sda2 on /mnt type ext4 (rw,relatime,data=ordered)
$ uname -a
Linux debian 4.14.13 #1 SMP Tue Mar 27 04:52:30 CST 2018 i686 GNU/Linux
$ 

Why I can (or cannot) again mount a mounted device? what is happened?

Why I can (or cannot) again mount a mounted device? what is happened?
For example:

/tmp/test$ sudo mount /dev/sda5 ./1;echo ${?}
0
/tmp/test$ sudo mount /dev/sda5 ./2;echo ${?}
0
/tmp/test$ sudo mount | grep test
/dev/sda5 on /tmp/test/1 type ext4 (rw,relatime,data=ordered)
/dev/sda5 on /tmp/test/2 type ext4 (rw,relatime,data=ordered)
/tmp/test$ sudo umount ./1 ./2;echo ${?}
0
/tmp/test$ sudo losetup
NAME       SIZELIMIT OFFSET AUTOCLEAR RO BACK-FILE          DIO
/dev/loop0         0      0         0  0 /tmp/test/grub.iso   0
/tmp/test$ sudo mount /dev/loop0 ./1;echo ${?}
mount: /dev/loop0 is write-protected, mounting read-only
0
/tmp/test$ sudo mount /dev/loop0 ./2;echo ${?}
mount: /dev/loop0 is already mounted or /tmp/test/2 busy
       /dev/loop0 is already mounted on /tmp/test/1
32
/tmp/test$ sudo mount | grep test
/dev/loop0 on /tmp/test/1 type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048)
/tmp/test$ 
Add fstab as comment request
Source Link
illiterate
  • 993
  • 7
  • 23
Loading
Source Link
illiterate
  • 993
  • 7
  • 23
Loading