[Comm] Как ядро заставить пересчитать устройство?
Kharitonov A. Dmitry
kharpost на rambler.ru
Вт Сен 17 12:46:24 MSK 2013
Требуется получить получить адекватный UUID
Вставляю SD карту
$ dmesg | tail
[ 289.425392] sd 4:0:0:0: [sde] Mode Sense: 03 00 00 00
[ 289.426736] sd 4:0:0:0: [sde] No Caching mode page present
[ 289.426757] sd 4:0:0:0: [sde] Assuming drive cache: write through
[ 289.436518] sd 4:0:0:0: [sde] No Caching mode page present
[ 289.436536] sd 4:0:0:0: [sde] Assuming drive cache: write through
[ 289.439109] sde: sde1 sde2 < sde5 >
[ 289.444068] sd 4:0:0:0: [sde] No Caching mode page present
[ 289.444092] sd 4:0:0:0: [sde] Assuming drive cache: write through
[ 289.444114] sd 4:0:0:0: [sde] Attached SCSI removable disk
[ 290.576258] FAT-fs (sde1): utf8 is not a recommended IO charset for
FAT filesystems, filesystem will be case sensitive!
$ sudo fdisk -l /dev/sde
Disk /dev/sde: 32.3 GB, 32295092224 bytes, 63076352 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x001105d9
Device Boot Start End Blocks Id System
/dev/sde1 2048 6293503 3145728 c W95 FAT32 (LBA)
/dev/sde2 6293504 63076351 28391424 f W95 Ext'd (LBA)
/dev/sde5 6295552 63076351 28390400 b W95 FAT32
$ sudo blkid | grep /dev/sde
/dev/sde1: LABEL="tr" UUID="C725-949A" TYPE="vfat"
/dev/sde5: LABEL="tr2" UUID="C885-03E6" TYPE="vfat"
Внимательно смотрим на UUID="C725-949A"
Это всё правильно. Теперь мне нужно переформатировать в ntfs
$ sudo umount /dev/sde1
$ sudo umount /dev/sde1
umount: /dev/sde1: not mounted
$ sudo umount /dev/sde5
umount: /dev/sde5: not mounted
$ sudo dd if=/dev/zero of=/dev/sde count=8k bs=4096
8192+0 records in
8192+0 records out
33554432 bytes (34 MB) copied, 2.94593 s, 11.4 MB/s
$ echo -ne "u\nc\nn\np\n\n\n\nt\n7\na\n1\nw\n" | sudo fdisk -S56 /dev/sde
Welcome to fdisk (util-linux 2.22.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0x218d0787.
Command (m for help): Changing display/entry units to cylinders
(DEPRECATED!)
Command (m for help): DOS Compatibility flag is set (DEPRECATED!)
Command (m for help): Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): Partition number (1-4, default 1): Using default value 1
First cylinder (1-17599, default 1): Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-17599, default 17599):
Using default value 17599
Partition 1 of type Linux and of size 30.1 GiB is set
Command (m for help): Selected partition 1
Hex code (type L to list codes): Changed system type of partition 1 to 7
(HPFS/NTFS/exFAT)
Command (m for help): Partition number (1-4):
Command (m for help): The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
$ sudo fdisk -l /dev/sde
Disk /dev/sde: 32.3 GB, 32295092224 bytes, 63076352 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x218d0787
Device Boot Start End Blocks Id System
/dev/sde1 * 56 63074815 31537380 7 HPFS/NTFS/exFAT
$ sudo mkfs.ntfs -f -c 4096 -L test /dev/sde1
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
А теперь внимание
$ sudo blkid | grep /dev/sde
/dev/sde1: LABEL="tr" UUID="C725-949A" TYPE="vfat"
UUID не изменился!!!
$ sudo partprobe
$ sudo blkid | grep /dev/sde
/dev/sde1: LABEL="tr" UUID="C725-949A" TYPE="vfat"
вынимаю и вставляю
$ dmesg | tail
[ 918.870892] sd 5:0:0:0: [sde] Write Protect is off
[ 918.870910] sd 5:0:0:0: [sde] Mode Sense: 03 00 00 00
[ 918.872078] sd 5:0:0:0: [sde] No Caching mode page present
[ 918.872093] sd 5:0:0:0: [sde] Assuming drive cache: write through
[ 918.877223] sd 5:0:0:0: [sde] No Caching mode page present
[ 918.877233] sd 5:0:0:0: [sde] Assuming drive cache: write through
[ 918.878631] sde: sde1
[ 918.882372] sd 5:0:0:0: [sde] No Caching mode page present
[ 918.882382] sd 5:0:0:0: [sde] Assuming drive cache: write through
[ 918.882390] sd 5:0:0:0: [sde] Attached SCSI removable disk
$ sudo blkid | grep /dev/sde
/dev/sde1: LABEL="tr" UUID="C725-949A" TYPE="vfat"
После перезагрузки
$ dmesg | tail
[ 139.522377] sd 4:0:0:0: [sde] Mode Sense: 03 00 00 00
[ 139.523479] sd 4:0:0:0: [sde] No Caching mode page present
[ 139.523495] sd 4:0:0:0: [sde] Assuming drive cache: write through
[ 139.531353] sd 4:0:0:0: [sde] No Caching mode page present
[ 139.531369] sd 4:0:0:0: [sde] Assuming drive cache: write through
[ 139.532754] sde: sde1
[ 139.536356] sd 4:0:0:0: [sde] No Caching mode page present
[ 139.536369] sd 4:0:0:0: [sde] Assuming drive cache: write through
[ 139.536381] sd 4:0:0:0: [sde] Attached SCSI removable disk
[ 144.687148] fuse init (API version 7.20)
$ sudo blkid | grep /dev/sde
/dev/sde1: LABEL="test" UUID="2130BC3E3BF9C94B" TYPE="ntfs"
За какую ручку дёргать чтоб не перезагружаться?
Подробная информация о списке рассылки community